home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / ell.lha / ell / src / CodeM2.mi < prev    next >
Text File  |  1992-08-18  |  74KB  |  2,269 lines

  1. (*
  2.  *    "CodeM2.mi"
  3.  *    generated with estra/8906
  4.  *    from " "
  5.  *
  6.  *    estra 
  7.  *    was written by Bertram Vielsack in june 1989
  8.  *
  9.  *)
  10.  
  11. IMPLEMENTATION MODULE CodeM2;
  12.  
  13. IMPORT SYSTEM, IO, Memory, System, Tree;
  14.  
  15.     (* line 26   *)
  16.  
  17. FROM ArgCheck    IMPORT    DEF, IMP, SourceFileName, cVersion;
  18. FROM Checks    IMPORT    CheckWriteOpen, CheckOpenOutput;
  19. FROM Codes    IMPORT    cNoIndex, vMaxRecSetIndex, vMaxSetIndex, EmptyRecSetIndex,
  20.             Code, MaxCode, WriteIndex, WriteRecIndex, GetSet, GetRecSet;
  21. FROM DynArray    IMPORT    MakeArray, ReleaseArray;
  22. FROM Errors    IMPORT    ERROR;
  23. FROM IO        IMPORT    tFile, WriteS, WriteI, WriteNl, WriteOpen, WriteClose;
  24. FROM Idents    IMPORT    tIdent, NoIdent, WriteIdent, MaxIdent, GetString;
  25. FROM Sets    IMPORT    tSet, MakeSet, ReleaseSet, Extract, IsEmpty, Assign, IsElement, Exclude;
  26. FROM StringMem    IMPORT    WriteString;
  27. FROM SYSTEM    IMPORT    TSIZE, ADR;
  28. FROM System    IMPORT    OpenOutput, Write, Close;
  29. FROM Scanner    IMPORT    Epsilon;
  30. FROM Types    IMPORT    IsTerm, IsNonterm, Terminals;
  31. FROM Strings    IMPORT    tString, Char, ArrayToString, Concatenate, Append, StringToArray;
  32. FROM Tree    IMPORT    ScannerName, ParserName;
  33.  
  34. CONST
  35.   cBitsPerBitset    = 32;
  36.   cDefinition        = '.md';
  37.   cImplementation    = '.mi';
  38.   cTable        = '.Tab';
  39.  
  40. VAR
  41.   file        : tFile;
  42.   SpaCo        : INTEGER;
  43.   vExport    : BOOLEAN;
  44.   InDefault    : BOOLEAN;
  45.   lSections    : Tree.tTree;
  46.   PathS, String    : tString;
  47.   PathA        : ARRAY [0..128] OF CHAR;
  48.  
  49. PROCEDURE Prefix;
  50.   BEGIN
  51.     IF ScannerName # NoIdent THEN
  52. Spaces;WriteIdent (file, ScannerName);
  53.     ELSE
  54. WriteS (file, 'Scanner');
  55.     END;
  56.   END Prefix;
  57.  
  58. PROCEDURE Spaces;
  59.   VAR i: INTEGER;
  60.   BEGIN FOR i := 1 TO SpaCo DO WriteS (file, '  '); END; END Spaces;
  61.  
  62. PROCEDURE CodeIsElement (index: INTEGER; set: tSet);
  63.   VAR
  64.     todo: tSet;
  65.     id: tIdent;
  66.   BEGIN
  67.     IF index = cNoIndex THEN
  68.       MakeSet (todo, MaxIdent ());
  69.       Assign (todo, set);
  70.       Exclude (todo, Epsilon);
  71.       IF NOT IsEmpty (todo) THEN
  72.     LOOP
  73.       id := Extract (todo);
  74.       WriteS (file, '(xxToken = ');
  75.       WriteI (file, Code (id), 0);
  76.       WriteS (file, ' (* ');
  77.       WriteIdent (file, id);
  78.       WriteS (file, ' *))');
  79.       IF IsEmpty (todo) THEN EXIT END;
  80.       WriteS (file, ' OR ');
  81.     END;
  82.       END;
  83.       ReleaseSet (todo);
  84.     ELSE
  85.       WriteS (file, '(');
  86.       WriteI (file, index MOD cBitsPerBitset, 0);
  87.       WriteS (file, ' IN xxVerticalSet');
  88.       WriteI (file, index DIV cBitsPerBitset, 0);
  89.       WriteS (file, ' [xxToken] (* ');
  90.       WriteIndex (file, index);
  91.       WriteS (file, ' *))');
  92.     END;
  93.   END CodeIsElement;
  94.  
  95. PROCEDURE CodeRecovery (recover, expect: INTEGER);
  96.   BEGIN
  97.     IF expect = cNoIndex THEN
  98. WriteS (file, 'xxUnexpected (');WriteI (file, recover, 0);WriteS (file, ', xxGlobalRecoverySet); (* ');WriteRecIndex (file, recover);WriteS (file, ' *)');WriteNl (file);
  99.     ELSE
  100. Spaces;WriteS (file, 'xxExpected (');WriteI (file, expect, 0);WriteS (file, ', ');WriteI (file, recover, 0);WriteS (file, ', xxGlobalRecoverySet); (* ');WriteRecIndex (file, expect);WriteS (file, ' / ');WriteRecIndex (file, recover);WriteS (file, ' *)');WriteNl (file);
  101.     END;
  102.   END CodeRecovery;
  103.  
  104. PROCEDURE WriteLabels (set: tSet);
  105.   VAR
  106.     todo: tSet;
  107.     id: tIdent;
  108.   BEGIN
  109.     MakeSet (todo, MaxIdent ());
  110.     Assign (todo, set);
  111.     Spaces;
  112.     WriteS (file, '| ');
  113.     IF NOT IsEmpty (todo) THEN
  114.       LOOP
  115.     id := Extract (todo);
  116.     WriteI (file, Code (id), 0);
  117.     WriteS (file, ' (* ');
  118.     WriteIdent (file, id);
  119.     WriteS (file, ' *)');
  120.     IF IsEmpty (todo) THEN EXIT END;
  121.     WriteS (file, ', ');
  122.       END;
  123.     END;
  124.     WriteS (file, ':');
  125.     WriteNl (file);
  126.     ReleaseSet (todo);
  127.   END WriteLabels;
  128.  
  129. VAR
  130.   NumberArray        : POINTER TO ARRAY [0..1000] OF INTEGER;
  131.   NumberArraySize    : LONGINT;
  132.   MaxNumberArray    : POINTER TO ARRAY [0..1000] OF INTEGER;
  133.   MaxNumberArraySize    : LONGINT;
  134.  
  135. PROCEDURE ClearArray (VAR a: ARRAY OF INTEGER);
  136.   VAR id: tIdent;
  137.   BEGIN
  138.     FOR id := 0 TO MaxIdent () DO a [id] := 0; END;
  139.   END ClearArray;
  140.  
  141. PROCEDURE WriteAttributes;
  142.   VAR
  143.     id: tIdent;
  144.     i, max: INTEGER;
  145.   BEGIN
  146.     FOR id := 0 TO MaxIdent () DO
  147.       max := MaxNumberArray^ [id];
  148.       IF max > 0 THEN
  149. Spaces;
  150.     FOR i := 1 TO max - 1 DO
  151. WriteIdent (file, id);WriteI (file, i, 0);WriteS (file, ', ');
  152.     END;
  153. WriteIdent (file, id);WriteI (file, max, 0);WriteS (file, ': ');
  154.     IF IsTerm (id) THEN
  155.       Prefix;
  156. WriteS (file, '.tScanAttribute');
  157.     ELSE
  158. WriteS (file, 'tParsAttribute');
  159.     END;
  160. WriteS (file, ';');WriteNl (file);
  161.       END;
  162.     END;
  163.   END WriteAttributes;
  164.  
  165. PROCEDURE WriteParsTab;
  166.   VAR
  167.     bitset: BITSET;
  168.     set: tSet;
  169.     sets: ARRAY [0..cBitsPerBitset-1] OF tSet;
  170.     size: INTEGER;
  171.     code,i,bit: INTEGER;
  172.     index: INTEGER;
  173.   BEGIN
  174.     GetString        (ParserName, PathS);
  175.     ArrayToString    (cTable, String);
  176.     Concatenate        (PathS, String);
  177.     Append        (PathS, 0C);
  178.     StringToArray    (PathS, PathA);
  179.     file := OpenOutput    (PathA);
  180.     CheckOpenOutput    (file, PathA);
  181.  
  182.     MakeSet (set, MaxCode ());
  183.     FOR index := 0 TO vMaxRecSetIndex DO
  184.       GetRecSet (index, set);
  185.       FOR i := 0 TO MaxCode () DIV cBitsPerBitset - 1 DO
  186.     bitset := {};
  187.         FOR bit := 0 TO cBitsPerBitset - 1 DO
  188.       IF IsElement (i * cBitsPerBitset + bit, set) THEN INCL (bitset, bit); END;
  189.     END;
  190.     size := Write (file, ADR (bitset), TSIZE (BITSET));
  191.       END;
  192.         i := MaxCode () DIV cBitsPerBitset;
  193.     bitset := {};
  194.         FOR bit := 0 TO MaxCode () MOD cBitsPerBitset DO
  195.       IF IsElement (i * cBitsPerBitset + bit, set) THEN INCL (bitset, bit); END;
  196.     END;
  197.     size := Write (file, ADR (bitset), TSIZE (BITSET));
  198.     END;
  199.     ReleaseSet (set);
  200.  
  201.     FOR bit := 0 TO cBitsPerBitset - 1 DO
  202.       MakeSet (sets [bit], MaxCode ());
  203.     END;
  204.     FOR i := 0 TO vMaxSetIndex DIV cBitsPerBitset DO
  205.       FOR bit := 0 TO cBitsPerBitset - 1 DO
  206.     index := i * cBitsPerBitset + bit;
  207.     IF index <= vMaxSetIndex THEN
  208.       GetSet (index, sets [bit]);
  209.         END;
  210.       END;
  211.       FOR code := 0 TO MaxCode () DO
  212.     bitset := {};
  213.     FOR bit := 0 TO cBitsPerBitset - 1 DO 
  214.       IF IsElement (code, sets [bit]) THEN INCL (bitset, bit); END;
  215.     END;
  216.     size := Write (file, ADR (bitset), TSIZE (BITSET));
  217.       END;
  218.     END;
  219.     FOR bit := 0 TO cBitsPerBitset - 1 DO
  220.       ReleaseSet (sets [bit]);
  221.     END;
  222.  
  223.     Close (file);
  224.   END WriteParsTab;
  225.  
  226.  
  227. CONST
  228.   yyInfinite = 715827882;
  229.  
  230.   yyBitsPerBitset = 32;
  231.   yySetSize = 56;
  232.   yyMaxIndex = 32;
  233.   yyCombSize = 303;      
  234.   yyStartState = 0;
  235.  
  236.   yyPoolSize = 10240;
  237.  
  238. TYPE
  239.   yytBlockPtr = POINTER TO yytBlock;
  240.   yytBlock =
  241.   RECORD
  242.     Successor: yytBlockPtr;
  243.     Block: ARRAY [1..yyPoolSize] OF CHAR;
  244.   END;
  245.  
  246.   yyStateType = INTEGER;
  247.   yySetType = ARRAY [0..yySetSize DIV yyBitsPerBitset] OF BITSET;
  248.   yySetsType = ARRAY [0..yyMaxIndex] OF yySetType;
  249.   yyCombType = ARRAY [0..yyCombSize] OF yyStateType;
  250.  
  251.   yyPCODE = PROCEDURE (Tree.tTree);
  252.   yyPCodeDef = PROCEDURE (Tree.tTree);
  253.   yyPCodeImp = PROCEDURE (Tree.tTree);
  254.   yyPCodeRules = PROCEDURE (Tree.tTree);
  255.   yyPCodeAltCase = PROCEDURE (Tree.tTree);
  256.   yyPCodeAltIf = PROCEDURE (Tree.tTree, BOOLEAN);
  257.   yyPSetNumbers = PROCEDURE (Tree.tTree, BOOLEAN);
  258.   yyPCodeExport = PROCEDURE (Tree.tTree);
  259.   yyPCodeGlobal = PROCEDURE (Tree.tTree);
  260.   yyPCodeLocal = PROCEDURE (Tree.tTree);
  261.   yyPCodeBegin = PROCEDURE (Tree.tTree);
  262.   yyPCodeClose = PROCEDURE (Tree.tTree);
  263.   yyPCodeCodes = PROCEDURE (Tree.tTree);
  264.   yyPCodeCodes2 = PROCEDURE (Tree.tTree);
  265.   
  266.   yyInfoPtr  = POINTER TO yyInfoType;
  267.   yyInfoType =
  268.     RECORD
  269.       CODE: RECORD Cost: INTEGER; Proc: yyPCODE; END;
  270.       CodeDef: RECORD Cost: INTEGER; Proc: yyPCodeDef; END;
  271.       CodeImp: RECORD Cost: INTEGER; Proc: yyPCodeImp; END;
  272.       CodeRules: RECORD Cost: INTEGER; Proc: yyPCodeRules; END;
  273.       CodeAltCase: RECORD Cost: INTEGER; Proc: yyPCodeAltCase; END;
  274.       CodeAltIf: RECORD Cost: INTEGER; Proc: yyPCodeAltIf; END;
  275.       SetNumbers: RECORD Cost: INTEGER; Proc: yyPSetNumbers; END;
  276.       CodeExport: RECORD Cost: INTEGER; Proc: yyPCodeExport; END;
  277.       CodeGlobal: RECORD Cost: INTEGER; Proc: yyPCodeGlobal; END;
  278.       CodeLocal: RECORD Cost: INTEGER; Proc: yyPCodeLocal; END;
  279.       CodeBegin: RECORD Cost: INTEGER; Proc: yyPCodeBegin; END;
  280.       CodeClose: RECORD Cost: INTEGER; Proc: yyPCodeClose; END;
  281.       CodeCodes: RECORD Cost: INTEGER; Proc: yyPCodeCodes; END;
  282.       CodeCodes2: RECORD Cost: INTEGER; Proc: yyPCodeCodes2; END;
  283.     END;
  284.  
  285. VAR
  286.   yySets: yySetsType;
  287.   yyComb: yyCombType;
  288.   yyInfo: yyInfoType;
  289.   yyMatch: ARRAY [0..56] OF BOOLEAN;
  290.   yyBlockList: yytBlockPtr;
  291.   yyPoolFreePtr, yyPoolEndPtr: SYSTEM.ADDRESS;
  292.  
  293. PROCEDURE yyAlloc (): SYSTEM.ADDRESS;
  294. VAR BlockPtr: yytBlockPtr;
  295. BEGIN
  296.   IF LONGINT (yyPoolEndPtr - yyPoolFreePtr) < SYSTEM.TSIZE (yyInfoType) THEN
  297.     BlockPtr  := yyBlockList;
  298.     yyBlockList  := Memory.Alloc (SYSTEM.TSIZE (yytBlock));
  299.     yyBlockList^.Successor := BlockPtr;
  300.     yyPoolFreePtr := SYSTEM.ADR (yyBlockList^.Block);
  301.     yyPoolEndPtr  := yyPoolFreePtr + yyPoolSize;
  302.   END;
  303.   INC (yyPoolFreePtr, SYSTEM.ADDRESS (SYSTEM.TSIZE (yyInfoType)));
  304.   RETURN yyPoolFreePtr - SYSTEM.ADDRESS (SYSTEM.TSIZE (yyInfoType));
  305. END yyAlloc;
  306.  
  307. PROCEDURE yyReleaseHeap;
  308. VAR BlockPtr: yytBlockPtr;
  309. BEGIN
  310.   WHILE yyBlockList # NIL DO
  311.     BlockPtr:= yyBlockList;
  312.     yyBlockList:= yyBlockList^.Successor;
  313.     Memory.Free (SYSTEM.TSIZE (yytBlock), BlockPtr);
  314.   END;
  315.   yyPoolFreePtr:= NIL;
  316.   yyPoolEndPtr:= NIL;
  317. END yyReleaseHeap;
  318.  
  319. PROCEDURE CODE (yyt: Tree.tTree);
  320. VAR InfoPtr: yyInfoPtr;
  321. BEGIN
  322.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  323.   InfoPtr^.CODE.Proc (yyt);
  324. END CODE;
  325.  
  326. PROCEDURE CodeDef (yyt: Tree.tTree);
  327. VAR InfoPtr: yyInfoPtr;
  328. BEGIN
  329.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  330.   InfoPtr^.CodeDef.Proc (yyt);
  331. END CodeDef;
  332.  
  333. PROCEDURE CodeImp (yyt: Tree.tTree);
  334. VAR InfoPtr: yyInfoPtr;
  335. BEGIN
  336.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  337.   InfoPtr^.CodeImp.Proc (yyt);
  338. END CodeImp;
  339.  
  340. PROCEDURE CodeRules (yyt: Tree.tTree);
  341. VAR InfoPtr: yyInfoPtr;
  342. BEGIN
  343.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  344.   InfoPtr^.CodeRules.Proc (yyt);
  345. END CodeRules;
  346.  
  347. PROCEDURE CodeAltCase (yyt: Tree.tTree);
  348. VAR InfoPtr: yyInfoPtr;
  349. BEGIN
  350.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  351.   InfoPtr^.CodeAltCase.Proc (yyt);
  352. END CodeAltCase;
  353.  
  354. PROCEDURE CodeAltIf (yyt: Tree.tTree;started:BOOLEAN);
  355. VAR InfoPtr: yyInfoPtr;
  356. BEGIN
  357.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  358.   InfoPtr^.CodeAltIf.Proc (yyt, started);
  359. END CodeAltIf;
  360.  
  361. PROCEDURE SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  362. VAR InfoPtr: yyInfoPtr;
  363. BEGIN
  364.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  365.   InfoPtr^.SetNumbers.Proc (yyt, start);
  366. END SetNumbers;
  367.  
  368. PROCEDURE CodeExport (yyt: Tree.tTree);
  369. VAR InfoPtr: yyInfoPtr;
  370. BEGIN
  371.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  372.   InfoPtr^.CodeExport.Proc (yyt);
  373. END CodeExport;
  374.  
  375. PROCEDURE CodeGlobal (yyt: Tree.tTree);
  376. VAR InfoPtr: yyInfoPtr;
  377. BEGIN
  378.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  379.   InfoPtr^.CodeGlobal.Proc (yyt);
  380. END CodeGlobal;
  381.  
  382. PROCEDURE CodeLocal (yyt: Tree.tTree);
  383. VAR InfoPtr: yyInfoPtr;
  384. BEGIN
  385.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  386.   InfoPtr^.CodeLocal.Proc (yyt);
  387. END CodeLocal;
  388.  
  389. PROCEDURE CodeBegin (yyt: Tree.tTree);
  390. VAR InfoPtr: yyInfoPtr;
  391. BEGIN
  392.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  393.   InfoPtr^.CodeBegin.Proc (yyt);
  394. END CodeBegin;
  395.  
  396. PROCEDURE CodeClose (yyt: Tree.tTree);
  397. VAR InfoPtr: yyInfoPtr;
  398. BEGIN
  399.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  400.   InfoPtr^.CodeClose.Proc (yyt);
  401. END CodeClose;
  402.  
  403. PROCEDURE CodeCodes (yyt: Tree.tTree);
  404. VAR InfoPtr: yyInfoPtr;
  405. BEGIN
  406.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  407.   InfoPtr^.CodeCodes.Proc (yyt);
  408. END CodeCodes;
  409.  
  410. PROCEDURE CodeCodes2 (yyt: Tree.tTree);
  411. VAR InfoPtr: yyInfoPtr;
  412. BEGIN
  413.   InfoPtr := yyInfoPtr (yyt^.yyHead.yyEstraInfo);
  414.   InfoPtr^.CodeCodes2.Proc (yyt);
  415. END CodeCodes2;
  416.  
  417. PROCEDURE yyECODE (yyt: Tree.tTree);
  418. BEGIN
  419.   IO.WriteS (IO.StdError, 'Function CODE is not defined for this tree');
  420.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  421. END yyECODE;
  422.  
  423. PROCEDURE yyECodeDef (yyt: Tree.tTree);
  424. BEGIN
  425.   IO.WriteS (IO.StdError, 'Function CodeDef is not defined for this tree');
  426.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  427. END yyECodeDef;
  428.  
  429. PROCEDURE yyECodeImp (yyt: Tree.tTree);
  430. BEGIN
  431.   IO.WriteS (IO.StdError, 'Function CodeImp is not defined for this tree');
  432.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  433. END yyECodeImp;
  434.  
  435. PROCEDURE yyECodeRules (yyt: Tree.tTree);
  436. BEGIN
  437.   IO.WriteS (IO.StdError, 'Function CodeRules is not defined for this tree');
  438.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  439. END yyECodeRules;
  440.  
  441. PROCEDURE yyECodeAltCase (yyt: Tree.tTree);
  442. BEGIN
  443.   IO.WriteS (IO.StdError, 'Function CodeAltCase is not defined for this tree');
  444.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  445. END yyECodeAltCase;
  446.  
  447. PROCEDURE yyECodeAltIf (yyt: Tree.tTree;started:BOOLEAN);
  448. BEGIN
  449.   IO.WriteS (IO.StdError, 'Function CodeAltIf is not defined for this tree');
  450.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  451. END yyECodeAltIf;
  452.  
  453. PROCEDURE yyESetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  454. BEGIN
  455.   IO.WriteS (IO.StdError, 'Function SetNumbers is not defined for this tree');
  456.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  457. END yyESetNumbers;
  458.  
  459. PROCEDURE yyECodeExport (yyt: Tree.tTree);
  460. BEGIN
  461.   IO.WriteS (IO.StdError, 'Function CodeExport is not defined for this tree');
  462.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  463. END yyECodeExport;
  464.  
  465. PROCEDURE yyECodeGlobal (yyt: Tree.tTree);
  466. BEGIN
  467.   IO.WriteS (IO.StdError, 'Function CodeGlobal is not defined for this tree');
  468.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  469. END yyECodeGlobal;
  470.  
  471. PROCEDURE yyECodeLocal (yyt: Tree.tTree);
  472. BEGIN
  473.   IO.WriteS (IO.StdError, 'Function CodeLocal is not defined for this tree');
  474.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  475. END yyECodeLocal;
  476.  
  477. PROCEDURE yyECodeBegin (yyt: Tree.tTree);
  478. BEGIN
  479.   IO.WriteS (IO.StdError, 'Function CodeBegin is not defined for this tree');
  480.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  481. END yyECodeBegin;
  482.  
  483. PROCEDURE yyECodeClose (yyt: Tree.tTree);
  484. BEGIN
  485.   IO.WriteS (IO.StdError, 'Function CodeClose is not defined for this tree');
  486.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  487. END yyECodeClose;
  488.  
  489. PROCEDURE yyECodeCodes (yyt: Tree.tTree);
  490. BEGIN
  491.   IO.WriteS (IO.StdError, 'Function CodeCodes is not defined for this tree');
  492.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  493. END yyECodeCodes;
  494.  
  495. PROCEDURE yyECodeCodes2 (yyt: Tree.tTree);
  496. BEGIN
  497.   IO.WriteS (IO.StdError, 'Function CodeCodes2 is not defined for this tree');
  498.   IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  499. END yyECodeCodes2;
  500.  
  501. PROCEDURE yyF1CODE (yyt: Tree.tTree);
  502.  
  503. BEGIN    (* line 308   *)
  504.  
  505.         IF DEF THEN
  506.           CodeDef (yyt);
  507.         END;
  508.         IF IMP THEN
  509.           CodeImp (yyt);
  510.           WriteParsTab;
  511.         END;
  512.         
  513. END yyF1CODE;
  514.  
  515. PROCEDURE yyF2CodeDef (yyt: Tree.tTree);
  516.  
  517. BEGIN    (* line 326   *)
  518.  
  519.         GetString    (ParserName, PathS);
  520.         ArrayToString    (cDefinition, String);
  521.         Concatenate    (PathS, String);
  522.         Append        (PathS, 0C);
  523.         StringToArray    (PathS, PathA);
  524.         file := WriteOpen (PathA);
  525.         CheckWriteOpen    (file, PathA);
  526.  
  527. Spaces;WriteS (file, 'DEFINITION MODULE ');WriteIdent (file, ParserName);WriteS (file, ';');WriteNl (file);
  528. Spaces;WriteNl (file);
  529.         CodeExport (yyt^.Grammar.sections);
  530.         IF NOT vExport THEN    (* Default EXPORT action *)
  531. Spaces;WriteS (file, 'IMPORT ');
  532.         Prefix;
  533. WriteS (file, ';');WriteNl (file);
  534. Spaces;WriteNl (file);
  535. Spaces;WriteS (file, 'TYPE tParsAttribute = ');
  536.         Prefix;
  537. WriteS (file, '.tScanAttribute;');WriteNl (file);
  538.         END;
  539. Spaces;WriteNl (file);
  540. Spaces;WriteS (file, 'VAR');WriteNl (file);
  541. Spaces;WriteS (file, '  ParsAttribute    : tParsAttribute;');WriteNl (file);
  542. Spaces;WriteS (file, '  ParsTabName    : ARRAY [0..128] OF CHAR;');WriteNl (file);
  543. Spaces;WriteNl (file);
  544. Spaces;WriteS (file, 'PROCEDURE ');WriteIdent (file, ParserName);WriteS (file, ' (): INTEGER;');WriteNl (file);
  545. Spaces;WriteS (file, 'PROCEDURE Close');WriteIdent (file, ParserName);WriteS (file, ' ();');WriteNl (file);
  546. Spaces;WriteS (file, 'PROCEDURE xxTokenName (Token: CARDINAL; VAR Name: ARRAY OF CHAR);');WriteNl (file);
  547. Spaces;WriteNl (file);
  548. Spaces;WriteS (file, 'END ');WriteIdent (file, ParserName);WriteS (file, '.');WriteNl (file);
  549.         WriteClose (file);
  550.         
  551. END yyF2CodeDef;
  552.  
  553. PROCEDURE yyF3CodeImp (yyt: Tree.tTree);
  554.     (* line 368   *)
  555.  VAR
  556.           i    : INTEGER;
  557.           set    : tSet;
  558.           id    : tIdent;
  559.           s    : tString;
  560.         
  561. BEGIN    (* line 374   *)
  562.  
  563.         GetString    (ParserName, PathS);
  564.         ArrayToString    (cImplementation, String);
  565.         Concatenate    (PathS, String);
  566.         Append        (PathS, 0C);
  567.         StringToArray    (PathS, PathA);
  568.         file := WriteOpen (PathA);
  569.         CheckWriteOpen    (file, PathA);
  570.  
  571. Spaces;WriteS (file, 'IMPLEMENTATION MODULE ');WriteIdent (file, ParserName);WriteS (file, ';');WriteNl (file);
  572. Spaces;WriteNl (file);
  573. Spaces;WriteS (file, 'IMPORT Positions, Errors, ');
  574.         Prefix;
  575. WriteS (file, ', Strings, System, SYSTEM;');WriteNl (file);
  576. Spaces;WriteNl (file);
  577.         CodeGlobal (yyt^.Grammar.sections);
  578.         lSections := yyt^.Grammar.sections;
  579.  
  580. Spaces;WriteS (file, 'CONST xxEof = 0;');WriteNl (file);
  581. Spaces;WriteNl (file);
  582. Spaces;WriteS (file, 'TYPE');WriteNl (file);
  583. Spaces;WriteS (file, '  xxtUnionPtr    = POINTER TO xxtUnion;');WriteNl (file);
  584. Spaces;WriteS (file, '  xxtUnion    = RECORD GlobalRecoverySet: xxtUnionPtr; LocalRecoverySet: SHORTCARD; END;');WriteNl (file);
  585. Spaces;WriteS (file, '  xxtSet    = ARRAY [0..');WriteI (file, MaxCode () DIV cBitsPerBitset, 0);WriteS (file, '] OF BITSET;');WriteNl (file);
  586. Spaces;WriteNl (file);
  587. Spaces;WriteS (file, 'VAR');WriteNl (file);
  588. Spaces;WriteS (file, '  xxToken        : SHORTCARD;');WriteNl (file);
  589. Spaces;WriteS (file, '  xxErrorCount        : INTEGER;');WriteNl (file);
  590. Spaces;WriteS (file, '  xxIsInitialized    : BOOLEAN;');WriteNl (file);
  591. Spaces;WriteS (file, '  xxIsRepairMode    : BOOLEAN;');WriteNl (file);
  592.         IF vMaxRecSetIndex = cNoIndex THEN
  593. Spaces;WriteS (file, '  xxHorizontalSet    : ARRAY [0..0] OF xxtSet;');WriteNl (file);
  594.         ELSE
  595. Spaces;WriteS (file, '  xxHorizontalSet    : ARRAY [0..');WriteI (file, vMaxRecSetIndex, 0);WriteS (file, '] OF xxtSet;');WriteNl (file);
  596.         END;
  597.         FOR i := 0 TO vMaxSetIndex DIV cBitsPerBitset DO
  598. Spaces;WriteS (file, '  xxVerticalSet');WriteI (file, i, 0);WriteS (file, '    : ARRAY [0..');WriteI (file, MaxCode (), 0);WriteS (file, '] OF BITSET;');WriteNl (file);
  599.         END;
  600. Spaces;WriteNl (file);
  601. Spaces;WriteS (file, 'PROCEDURE xxTokenName (Token: CARDINAL; VAR Name: ARRAY OF CHAR);');WriteNl (file);
  602. Spaces;WriteS (file, '  PROCEDURE Copy (Source: ARRAY OF CHAR; VAR Target: ARRAY OF CHAR);');WriteNl (file);
  603. Spaces;WriteS (file, '    VAR i, j: CARDINAL;');WriteNl (file);
  604. Spaces;WriteS (file, '    BEGIN');WriteNl (file);
  605. Spaces;WriteS (file, '      IF HIGH (Source) < HIGH (Target)');WriteNl (file);
  606. Spaces;WriteS (file, '      THEN j := HIGH (Source); ELSE j := HIGH (Target); END;');WriteNl (file);
  607. Spaces;WriteS (file, '      FOR i := 0 TO j DO Target [i] := Source [i]; END;');WriteNl (file);
  608. Spaces;WriteS (file, '      IF HIGH (Target) > j THEN Target [j + 1] := CHR (0); END;');WriteNl (file);
  609. Spaces;WriteS (file, '    END Copy;');WriteNl (file);
  610. Spaces;WriteS (file, '  BEGIN');WriteNl (file);
  611. Spaces;WriteS (file, '    CASE Token OF');WriteNl (file);
  612.         MakeSet (set, MaxIdent ());
  613.         Terminals (set);
  614.         Exclude (set, Epsilon);
  615.         WHILE NOT IsEmpty (set) DO
  616.           id := Extract (set);
  617.           GetString (id, s);
  618.           IF (Char (s, 1) = "'") THEN
  619.  
  620. Spaces;WriteS (file, '    | ');WriteI (file, Code (id), 0);WriteS (file, ': Copy (');WriteIdent (file, id);WriteS (file, ', Name);');WriteNl (file);
  621.  
  622.           ELSIF (Char (s, 1) = '"') THEN
  623. Spaces;WriteS (file, "    | ");WriteI (file, Code (id), 0);WriteS (file, ": Copy (");WriteIdent (file, id);WriteS (file, ", Name);");WriteNl (file);
  624.           ELSE
  625. Spaces;WriteS (file, "    | ");WriteI (file, Code (id), 0);WriteS (file, ": Copy ('");WriteIdent (file, id);WriteS (file, "', Name);");WriteNl (file);
  626.           END;
  627.         END;
  628.         ReleaseSet (set);
  629. Spaces;WriteS (file, "    END;");WriteNl (file);
  630. Spaces;WriteS (file, "  END xxTokenName;");WriteNl (file);
  631. Spaces;WriteNl (file);
  632. Spaces;WriteS (file, "PROCEDURE ");WriteIdent (file, ParserName);WriteS (file, " (): INTEGER;");WriteNl (file);
  633. INC (SpaCo);
  634. Spaces;WriteS (file, "BEGIN");WriteNl (file);
  635. INC (SpaCo);
  636. Spaces;WriteS (file, "xxErrorCount := 0;");WriteNl (file);
  637. Spaces;WriteS (file, "Begin");WriteIdent (file, ParserName);WriteS (file, ";");WriteNl (file);
  638. Spaces;WriteS (file, "xxToken := ");
  639.         Prefix;
  640. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  641. Spaces;WriteS (file, "yy");WriteIdent (file, yyt^.Grammar.rules^.Rules.rule^.Rule.id^.Id.ident);WriteS (file, " (ParsAttribute, NIL);");WriteNl (file);
  642. Spaces;WriteS (file, "IF xxToken # xxEof THEN xxRecoveryLiteral (xxEof, ");WriteI (file, EmptyRecSetIndex, 0);WriteS (file, ", NIL); END;");WriteNl (file);
  643. Spaces;WriteS (file, "RETURN xxErrorCount;");WriteNl (file);
  644. DEC (SpaCo);
  645. Spaces;WriteS (file, "END ");WriteIdent (file, ParserName);WriteS (file, ";");WriteNl (file);
  646. DEC (SpaCo);
  647. Spaces;WriteNl (file);
  648. Spaces;WriteS (file, "PROCEDURE xxIsElement (VAR Set: xxtSet; Element: SHORTCARD): BOOLEAN;");WriteNl (file);
  649. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  650. Spaces;WriteS (file, "    RETURN Element MOD ");WriteI (file, cBitsPerBitset, 0);WriteS (file, " IN Set [Element DIV ");WriteI (file, cBitsPerBitset, 0);WriteS (file, "];");WriteNl (file);
  651. Spaces;WriteS (file, "  END xxIsElement;");WriteNl (file);
  652. Spaces;WriteNl (file);
  653. Spaces;WriteS (file, "PROCEDURE xxUnexpected (LocalRecoverySet: SHORTCARD; GlobalRecoverySet: xxtUnionPtr);");WriteNl (file);
  654. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  655. Spaces;WriteS (file, "    IF NOT xxIsRepairMode THEN");WriteNl (file);
  656. Spaces;WriteS (file, "      INC (xxErrorCount);");WriteNl (file);
  657. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.SyntaxError, Errors.Error, ");
  658.         Prefix;
  659. WriteS (file, ".Attribute.Position);");WriteNl (file);
  660. Spaces;WriteS (file, "      xxSkipTokens (LocalRecoverySet, GlobalRecoverySet);");WriteNl (file);
  661. Spaces;WriteS (file, "    END;");WriteNl (file);
  662. Spaces;WriteS (file, "  END xxUnexpected;");WriteNl (file);
  663. Spaces;WriteNl (file);
  664. Spaces;WriteS (file, "PROCEDURE xxExpected (ExpectedSet: SHORTCARD; LocalRecoverySet: SHORTCARD; GlobalRecoverySet: xxtUnionPtr);");WriteNl (file);
  665. Spaces;WriteS (file, "  VAR");WriteNl (file);
  666. Spaces;WriteS (file, "    Token        : SHORTCARD;");WriteNl (file);
  667. Spaces;WriteS (file, "    TokenArray        : ARRAY [0..127] OF CHAR;");WriteNl (file);
  668. Spaces;WriteS (file, "    TokenString        : Strings.tString;");WriteNl (file);
  669. Spaces;WriteS (file, "    ContinueString    : Strings.tString;");WriteNl (file);
  670. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  671. Spaces;WriteS (file, "    IF NOT xxIsRepairMode THEN");WriteNl (file);
  672. Spaces;WriteS (file, "      INC (xxErrorCount);");WriteNl (file);
  673. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.SyntaxError, Errors.Error, ");
  674.         Prefix;
  675. WriteS (file, ".Attribute.Position);");WriteNl (file);
  676. Spaces;WriteS (file, "      Strings.AssignEmpty (ContinueString);");WriteNl (file);
  677. Spaces;WriteS (file, "      FOR Token := 0 TO ");WriteI (file, MaxCode (), 0);WriteS (file, " DO");WriteNl (file);
  678. Spaces;WriteS (file, "        IF xxIsElement (xxHorizontalSet [ExpectedSet], Token) THEN");WriteNl (file);
  679. Spaces;WriteS (file, "      xxTokenName (Token, TokenArray);");WriteNl (file);
  680. Spaces;WriteS (file, "      Strings.ArrayToString (TokenArray, TokenString);");WriteNl (file);
  681. Spaces;WriteS (file, "      IF (Strings.Length (ContinueString) + Strings.Length (TokenString) + 1 <= Strings.cMaxStrLength) THEN");WriteNl (file);
  682. Spaces;WriteS (file, "        Strings.Concatenate (ContinueString, TokenString);");WriteNl (file);
  683. Spaces;WriteS (file, "        Strings.Append (ContinueString, ' ');");WriteNl (file);
  684. Spaces;WriteS (file, "      END;");WriteNl (file);
  685. Spaces;WriteS (file, "        END;");WriteNl (file);
  686. Spaces;WriteS (file, "      END;");WriteNl (file);
  687. Spaces;WriteS (file, "      Errors.ErrorMessageI (Errors.ExpectedTokens, Errors.Information, ");
  688.         Prefix;
  689. WriteS (file, ".Attribute.Position, Errors.String, SYSTEM.ADR (ContinueString));");WriteNl (file);
  690. Spaces;WriteS (file, "      xxSkipTokens (LocalRecoverySet, GlobalRecoverySet);");WriteNl (file);
  691. Spaces;WriteS (file, "    END;");WriteNl (file);
  692. Spaces;WriteS (file, "  END xxExpected;");WriteNl (file);
  693. Spaces;WriteNl (file);
  694. Spaces;WriteS (file, "PROCEDURE xxRecoveryLiteral (Expected: SHORTCARD; LocalRecoverySet: SHORTCARD; GlobalRecoverySet: xxtUnionPtr);");WriteNl (file);
  695. Spaces;WriteS (file, "  VAR TokenString: ARRAY [0..127] OF CHAR;");WriteNl (file);
  696. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  697. Spaces;WriteS (file, "    IF NOT xxIsRepairMode THEN");WriteNl (file);
  698. Spaces;WriteS (file, "      INC (xxErrorCount);");WriteNl (file);
  699. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.SyntaxError, Errors.Error, ");
  700.         Prefix;
  701. WriteS (file, ".Attribute.Position);");WriteNl (file);
  702. Spaces;WriteS (file, "      xxTokenName (Expected, TokenString);");WriteNl (file);
  703. Spaces;WriteS (file, "      Errors.ErrorMessageI (Errors.ExpectedTokens, Errors.Information, ");
  704.         Prefix;
  705. WriteS (file, ".Attribute.Position, Errors.Array, SYSTEM.ADR (TokenString));");WriteNl (file);
  706. Spaces;WriteS (file, "      xxSkipTokens (LocalRecoverySet, GlobalRecoverySet);");WriteNl (file);
  707. Spaces;WriteS (file, "    END;");WriteNl (file);
  708. Spaces;WriteS (file, "    IF xxToken # Expected THEN");WriteNl (file);
  709. Spaces;WriteS (file, "      xxTokenName (Expected, TokenString);");WriteNl (file);
  710. Spaces;WriteS (file, "      Errors.ErrorMessageI (Errors.TokenInserted, Errors.Repair, ");
  711.         Prefix;
  712. WriteS (file, ".Attribute.Position, Errors.Array, SYSTEM.ADR (TokenString));");WriteNl (file);
  713. Spaces;WriteS (file, "    ELSE");WriteNl (file);
  714. Spaces;WriteS (file, "      IF xxToken # xxEof THEN xxToken := ");
  715.         Prefix;
  716. WriteS (file, ".GetToken (); END;");WriteNl (file);
  717. Spaces;WriteS (file, "      xxIsRepairMode := FALSE;");WriteNl (file);
  718. Spaces;WriteS (file, "    END;");WriteNl (file);
  719. Spaces;WriteS (file, "  END xxRecoveryLiteral;");WriteNl (file);
  720. Spaces;WriteNl (file);
  721. Spaces;WriteS (file, "PROCEDURE xxRecoveryTerminal (Expected: SHORTCARD; LocalRecoverySet: SHORTCARD; GlobalRecoverySet: xxtUnionPtr; VAR RepairAttribute: ");
  722.         Prefix;
  723. WriteS (file, ".tScanAttribute);");WriteNl (file);
  724. Spaces;WriteS (file, "  VAR TokenString: ARRAY [0..127] OF CHAR;");WriteNl (file);
  725. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  726. Spaces;WriteS (file, "    IF NOT xxIsRepairMode THEN");WriteNl (file);
  727. Spaces;WriteS (file, "      INC (xxErrorCount);");WriteNl (file);
  728. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.SyntaxError, Errors.Error, ");
  729.         Prefix;
  730. WriteS (file, ".Attribute.Position);");WriteNl (file);
  731. Spaces;WriteS (file, "      xxTokenName (Expected, TokenString);");WriteNl (file);
  732. Spaces;WriteS (file, "      Errors.ErrorMessageI (Errors.ExpectedTokens, Errors.Information, ");
  733.         Prefix;
  734. WriteS (file, ".Attribute.Position, Errors.Array, SYSTEM.ADR (TokenString));");WriteNl (file);
  735. Spaces;WriteS (file, "      xxSkipTokens (LocalRecoverySet, GlobalRecoverySet);");WriteNl (file);
  736. Spaces;WriteS (file, "    END;");WriteNl (file);
  737. Spaces;WriteS (file, "    IF xxToken # Expected THEN");WriteNl (file);
  738. Spaces;WriteS (file, "      xxTokenName (Expected, TokenString);");WriteNl (file);
  739. Spaces;WriteS (file, "      Errors.ErrorMessageI (Errors.TokenInserted, Errors.Repair, ");
  740.         Prefix;
  741. WriteS (file, ".Attribute.Position, Errors.Array, SYSTEM.ADR (TokenString));");WriteNl (file);
  742. Spaces;WriteS (file, "      ");
  743.         Prefix;
  744. WriteS (file, ".ErrorAttribute (Expected, RepairAttribute);");WriteNl (file);
  745. Spaces;WriteS (file, "    ELSE");WriteNl (file);
  746. Spaces;WriteS (file, "      RepairAttribute := ");
  747.         Prefix;
  748. WriteS (file, ".Attribute;");WriteNl (file);
  749. Spaces;WriteS (file, "      IF xxToken # xxEof THEN xxToken := ");
  750.         Prefix;
  751. WriteS (file, ".GetToken (); END;");WriteNl (file);
  752. Spaces;WriteS (file, "      xxIsRepairMode := FALSE;");WriteNl (file);
  753. Spaces;WriteS (file, "    END;");WriteNl (file);
  754. Spaces;WriteS (file, "  END xxRecoveryTerminal;");WriteNl (file);
  755. Spaces;WriteNl (file);
  756. Spaces;WriteS (file, "PROCEDURE xxSkipTokens (LocalRecoverySet: SHORTCARD; GlobalRecoverySet: xxtUnionPtr);");WriteNl (file);
  757. Spaces;WriteS (file, "  VAR RecoverySet: xxtSet;");WriteNl (file);
  758. Spaces;WriteS (file, "      TokensSkipped: BOOLEAN;");WriteNl (file);
  759. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  760. Spaces;WriteS (file, "    RecoverySet := xxHorizontalSet [LocalRecoverySet];");WriteNl (file);
  761. Spaces;WriteS (file, "    INCL (RecoverySet [0], xxEof);");WriteNl (file);
  762. Spaces;WriteS (file, "    WHILE GlobalRecoverySet # NIL DO");WriteNl (file);
  763.         FOR i := 0 TO MaxCode () DIV cBitsPerBitset DO
  764. Spaces;WriteS (file, "      RecoverySet [");WriteI (file, i, 0);WriteS (file, "] := RecoverySet [");WriteI (file, i, 0);WriteS (file, "] + xxHorizontalSet [GlobalRecoverySet^.LocalRecoverySet] [");WriteI (file, i, 0);WriteS (file, "];");WriteNl (file);
  765.         END;
  766. Spaces;WriteS (file, "      GlobalRecoverySet := GlobalRecoverySet^.GlobalRecoverySet;");WriteNl (file);
  767. Spaces;WriteS (file, "    END;");WriteNl (file);
  768. Spaces;WriteS (file, "    TokensSkipped := FALSE;");WriteNl (file);
  769. Spaces;WriteS (file, "    WHILE NOT xxIsElement (RecoverySet, xxToken) DO");WriteNl (file);
  770. Spaces;WriteS (file, "      xxToken := ");
  771.         Prefix;
  772. WriteS (file, ".GetToken ();");WriteNl (file);
  773. Spaces;WriteS (file, "      TokensSkipped := TRUE;");WriteNl (file);
  774. Spaces;WriteS (file, "    END;");WriteNl (file);
  775. Spaces;WriteS (file, "    IF TokensSkipped THEN");WriteNl (file);
  776. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.RestartPoint, Errors.Information, ");
  777.         Prefix;
  778. WriteS (file, ".Attribute.Position);");WriteNl (file);
  779. Spaces;WriteS (file, "    END;");WriteNl (file);
  780. Spaces;WriteS (file, "    xxIsRepairMode := TRUE;");WriteNl (file);
  781. Spaces;WriteS (file, "  END xxSkipTokens;");WriteNl (file);
  782. Spaces;WriteNl (file);
  783. Spaces;WriteS (file, "PROCEDURE Begin");WriteIdent (file, ParserName);WriteS (file, ";");WriteNl (file);
  784. Spaces;WriteS (file, "  VAR");WriteNl (file);
  785. Spaces;WriteS (file, "    xxTableFile: System.tFile;");WriteNl (file);
  786. Spaces;WriteS (file, "    xxSize: CARDINAL;");WriteNl (file);
  787. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  788. Spaces;WriteS (file, "    IF xxIsInitialized THEN RETURN; END;");WriteNl (file);
  789.         CodeBegin (yyt^.Grammar.sections);
  790. Spaces;WriteS (file, "    xxTableFile := System.OpenInput (ParsTabName);");WriteNl (file);
  791. Spaces;WriteS (file, "    IF xxTableFile < 0 THEN");WriteNl (file);
  792. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.ReadParseTable, Errors.Fatal, Positions.NoPosition);");WriteNl (file);
  793. Spaces;WriteS (file, "    END;");WriteNl (file);
  794.         IF vMaxRecSetIndex # cNoIndex THEN
  795. Spaces;WriteS (file, "    xxSize := System.Read (xxTableFile, SYSTEM.ADR (xxHorizontalSet), SIZE (xxHorizontalSet));");WriteNl (file);
  796. Spaces;WriteS (file, "    IF xxSize # SIZE (xxHorizontalSet) THEN");WriteNl (file);
  797. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.ReadParseTable, Errors.Fatal, Positions.NoPosition);");WriteNl (file);
  798. Spaces;WriteS (file, "    END;");WriteNl (file);
  799.         END;
  800.         FOR i := 0 TO vMaxSetIndex DIV cBitsPerBitset DO
  801. Spaces;WriteS (file, "    xxSize := System.Read (xxTableFile, SYSTEM.ADR (xxVerticalSet");WriteI (file, i, 0);WriteS (file, "), SIZE (xxVerticalSet");WriteI (file, i, 0);WriteS (file, "));");WriteNl (file);
  802. Spaces;WriteS (file, "    IF xxSize # SIZE (xxVerticalSet");WriteI (file, i, 0);WriteS (file, ") THEN");WriteNl (file);
  803. Spaces;WriteS (file, "      Errors.ErrorMessage (Errors.ReadParseTable, Errors.Fatal, Positions.NoPosition);");WriteNl (file);
  804. Spaces;WriteS (file, "    END;");WriteNl (file);
  805.         END;
  806. Spaces;WriteS (file, "    System.Close (xxTableFile);");WriteNl (file);
  807. Spaces;WriteS (file, "    xxIsInitialized := TRUE;");WriteNl (file);
  808. Spaces;WriteS (file, "  END Begin");WriteIdent (file, ParserName);WriteS (file, ";");WriteNl (file);
  809. Spaces;WriteNl (file);
  810. Spaces;WriteS (file, "PROCEDURE Close");WriteIdent (file, ParserName);WriteS (file, ";");WriteNl (file);
  811. Spaces;WriteS (file, "  BEGIN");WriteNl (file);
  812.         CodeClose (yyt^.Grammar.sections);
  813. Spaces;WriteS (file, "  END Close");WriteIdent (file, ParserName);WriteS (file, ";");WriteNl (file);
  814. Spaces;WriteNl (file);
  815.         NumberArraySize := MaxIdent () + 1;
  816.         MaxNumberArraySize := MaxIdent () + 1;
  817.         MakeArray (NumberArray, NumberArraySize, TSIZE (INTEGER));
  818.         MakeArray (MaxNumberArray, MaxNumberArraySize, TSIZE (INTEGER));
  819.         CodeRules (yyt^.Grammar.rules);
  820.         ReleaseArray (NumberArray, NumberArraySize, TSIZE (INTEGER));
  821.         ReleaseArray (MaxNumberArray, MaxNumberArraySize, TSIZE (INTEGER));
  822.  
  823. Spaces;WriteS (file, "BEGIN");WriteNl (file);
  824. Spaces;WriteS (file, "  xxIsInitialized := FALSE;");WriteNl (file);
  825. Spaces;WriteS (file, "  ParsTabName := '");WriteIdent (file, ParserName);WriteS (file, cTable);WriteS (file, "';");WriteNl (file);
  826. Spaces;WriteS (file, "END ");WriteIdent (file, ParserName);WriteS (file, ".");WriteNl (file);
  827.  
  828.         WriteClose (file);
  829.         
  830. END yyF3CodeImp;
  831.  
  832. PROCEDURE yyF4CodeImp (yyt: Tree.tTree);
  833.  
  834. BEGIN    (* line 644   *)
  835.  
  836.         ERROR ('CodeM2.ESTRA: no rules');
  837.         
  838. END yyF4CodeImp;
  839.  
  840. PROCEDURE yyF5CodeRules (yyt: Tree.tTree);
  841.  
  842. BEGIN
  843. END yyF5CodeRules;
  844.  
  845. PROCEDURE yyF6CodeRules (yyt: Tree.tTree);
  846.  
  847. BEGIN    (* line 658   *)
  848.  
  849.         ClearArray (MaxNumberArray^);
  850.         SetNumbers (yyt^.Rules.rule^.Rule.expr, TRUE);
  851. Spaces;WriteS (file, "PROCEDURE yy");WriteIdent (file, yyt^.Rules.rule^.Rule.id^.Id.ident);WriteS (file, " (VAR ");WriteIdent (file, yyt^.Rules.rule^.Rule.id^.Id.ident);WriteS (file, "0: tParsAttribute; xxGlobalRecoverySet: xxtUnionPtr);");WriteNl (file);
  852. INC (SpaCo);
  853. Spaces;WriteS (file, "VAR");WriteNl (file);
  854. INC (SpaCo);
  855.           WriteAttributes;
  856.           IF yyt^.Rules.rule^.Rule.iscalling THEN
  857. Spaces;WriteS (file, "xxUnion: xxtUnion;");WriteNl (file);
  858.           END;
  859.           CodeLocal (lSections);
  860.           CodeCodes (yyt^.Rules.rule^.Rule.codes);
  861. DEC (SpaCo);
  862. Spaces;WriteS (file, "BEGIN");WriteNl (file);
  863. INC (SpaCo);
  864.           IF yyt^.Rules.rule^.Rule.iscalling THEN
  865. Spaces;WriteS (file, "xxUnion.GlobalRecoverySet := xxGlobalRecoverySet;");WriteNl (file);
  866.           END;
  867.           CodeRules (yyt^.Rules.rule^.Rule.expr);
  868. DEC (SpaCo);
  869. Spaces;WriteS (file, "END yy");WriteIdent (file, yyt^.Rules.rule^.Rule.id^.Id.ident);WriteS (file, ";");WriteNl (file);
  870. DEC (SpaCo);
  871. Spaces;WriteNl (file);
  872.         CodeRules (yyt^.Rules.rules);
  873.         
  874. END yyF6CodeRules;
  875.  
  876. PROCEDURE yyF7CodeRules (yyt: Tree.tTree);
  877.  
  878. BEGIN    (* line 686   *)
  879.  
  880. Spaces;WriteS (file, "LOOP");WriteNl (file);
  881. INC (SpaCo);
  882. Spaces;WriteS (file, "IF ");
  883.             CodeIsElement (yyt^.Option.index, yyt^.Option.first);
  884. WriteS (file, " THEN");WriteNl (file);
  885. INC (SpaCo);
  886.             InDefault := FALSE;
  887.             CodeRules (yyt^.Option.expr);
  888. Spaces;WriteS (file, "EXIT;");WriteNl (file);
  889. DEC (SpaCo);
  890. Spaces;WriteS (file, "ELSIF ");
  891.             CodeIsElement (yyt^.Option.followindex, yyt^.Option.follow);
  892. WriteS (file, " OR xxIsRepairMode THEN EXIT; END;");WriteNl (file);
  893.           CodeRecovery (yyt^.Option.recindex, yyt^.Option.expindex);
  894. DEC (SpaCo);
  895. Spaces;WriteS (file, "END;");WriteNl (file);
  896.         
  897. END yyF7CodeRules;
  898.  
  899. PROCEDURE yyF8CodeRules (yyt: Tree.tTree);
  900.  
  901. BEGIN    (* line 706   *)
  902.  
  903. Spaces;WriteS (file, "LOOP");WriteNl (file);
  904. INC (SpaCo);
  905. Spaces;WriteS (file, "IF ");
  906.             CodeIsElement (yyt^.Times.index, yyt^.Times.first);
  907. WriteS (file, " THEN");WriteNl (file);
  908. INC (SpaCo);
  909.             InDefault := FALSE;
  910.             CodeRules (yyt^.Times.expr);
  911. DEC (SpaCo);
  912. Spaces;WriteS (file, "ELSIF ");
  913.             CodeIsElement (yyt^.Times.followindex, yyt^.Times.follow);
  914. WriteS (file, " OR xxIsRepairMode THEN EXIT;");WriteNl (file);
  915. Spaces;WriteS (file, "ELSE");WriteNl (file);
  916. Spaces;WriteS (file, " ");WriteNl (file);
  917.             CodeRecovery (yyt^.Times.recindex, yyt^.Times.expindex);
  918. Spaces;WriteS (file, "END;");WriteNl (file);
  919. DEC (SpaCo);
  920. Spaces;WriteS (file, "END;");WriteNl (file);
  921.         
  922. END yyF8CodeRules;
  923.  
  924. PROCEDURE yyF9CodeRules (yyt: Tree.tTree);
  925.  
  926. BEGIN    (* line 728   *)
  927.  
  928. Spaces;WriteS (file, "LOOP");WriteNl (file);
  929. INC (SpaCo);
  930.           CodeRules (yyt^.Plus.expr);
  931. Spaces;WriteS (file, "IF NOT (");
  932.             CodeIsElement (yyt^.Plus.index, yyt^.Plus.first);
  933. WriteS (file, ") THEN");WriteNl (file);
  934. INC (SpaCo);
  935. Spaces;WriteS (file, "IF ");
  936.               CodeIsElement (yyt^.Plus.followindex, yyt^.Plus.follow);
  937. WriteS (file, " THEN EXIT; END;");WriteNl (file);
  938.             CodeRecovery (yyt^.Plus.recindex, yyt^.Plus.expindex);
  939. Spaces;WriteS (file, "IF NOT (");
  940.               CodeIsElement (yyt^.Plus.index, yyt^.Plus.first);
  941. WriteS (file, ") THEN EXIT; END;");WriteNl (file);
  942. DEC (SpaCo);
  943. Spaces;WriteS (file, "END;");WriteNl (file);
  944. DEC (SpaCo);
  945. Spaces;WriteS (file, "END;");WriteNl (file);
  946.         
  947. END yyF9CodeRules;
  948.  
  949. PROCEDURE yyF10CodeRules (yyt: Tree.tTree);
  950.  
  951. BEGIN    (* line 750   *)
  952.  
  953. Spaces;WriteS (file, "LOOP");WriteNl (file);
  954. INC (SpaCo);
  955.           CodeRules (yyt^.List.body);
  956. Spaces;WriteS (file, "IF NOT (");
  957.             CodeIsElement (yyt^.List.sep^.expr.index, yyt^.List.sep^.expr.first);
  958. WriteS (file, ") THEN");WriteNl (file);
  959. INC (SpaCo);
  960. Spaces;WriteS (file, "IF ");
  961.               CodeIsElement (yyt^.List.followindex, yyt^.List.follow);
  962. WriteS (file, " THEN EXIT; END;");WriteNl (file);
  963.             CodeRecovery (yyt^.List.recindex, yyt^.List.expindex);
  964. Spaces;WriteS (file, "IF NOT (");
  965.               CodeIsElement (yyt^.List.sep^.expr.index, yyt^.List.sep^.expr.first);
  966. WriteS (file, " OR ");
  967.               CodeIsElement (yyt^.List.index, yyt^.List.first);
  968. WriteS (file, ") THEN EXIT; END;");WriteNl (file);
  969. DEC (SpaCo);
  970. Spaces;WriteS (file, "END;");WriteNl (file);
  971.           CodeRules (yyt^.List.sep);
  972. DEC (SpaCo);
  973. Spaces;WriteS (file, "END;");WriteNl (file);
  974.         
  975. END yyF10CodeRules;
  976.  
  977. PROCEDURE yyF11CodeRules (yyt: Tree.tTree);
  978.  
  979. BEGIN
  980. END yyF11CodeRules;
  981.  
  982. PROCEDURE yyF12CodeRules (yyt: Tree.tTree);
  983.  
  984. BEGIN    (* line 776   *)
  985.  CodeCodes (yyt^.Action.codes); 
  986. END yyF12CodeRules;
  987.  
  988. PROCEDURE yyF13CodeRules (yyt: Tree.tTree);
  989.  
  990. BEGIN    (* line 780   *)
  991.  
  992.         IF InDefault THEN
  993. Spaces;WriteS (file, "IF xxToken # ");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, " (* ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteS (file, " *) THEN");WriteNl (file);
  994. Spaces;WriteS (file, "  xxRecoveryTerminal (");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, ", ");WriteI (file, yyt^.Leaf.recindex, 0);WriteS (file, ", xxGlobalRecoverySet, ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteI (file, yyt^.Leaf.number, 0);WriteS (file, "); (* ");WriteRecIndex (file, yyt^.Leaf.recindex);WriteS (file, " *)");WriteNl (file);
  995. Spaces;WriteS (file, "ELSE");WriteNl (file);
  996. Spaces;WriteS (file, "  ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteI (file, yyt^.Leaf.number, 0);WriteS (file, " := ");
  997.         Prefix;
  998. WriteS (file, ".Attribute;");WriteNl (file);
  999. Spaces;WriteS (file, "  xxToken := ");
  1000.         Prefix;
  1001. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  1002. Spaces;WriteS (file, "END;");WriteNl (file);
  1003.           InDefault := FALSE;
  1004.         ELSE
  1005. Spaces;WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteI (file, yyt^.Leaf.number, 0);WriteS (file, " := ");
  1006.         Prefix;
  1007. WriteS (file, ".Attribute;");WriteNl (file);
  1008. Spaces;WriteS (file, "xxToken := ");
  1009.         Prefix;
  1010. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  1011.         END;
  1012.         
  1013. END yyF13CodeRules;
  1014.  
  1015. PROCEDURE yyF14CodeRules (yyt: Tree.tTree);
  1016.  
  1017. BEGIN    (* line 805   *)
  1018.  
  1019.         IF InDefault THEN
  1020. Spaces;WriteS (file, "IF xxToken # ");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, " (* ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteS (file, " *) THEN");WriteNl (file);
  1021. Spaces;WriteS (file, "  xxRecoveryLiteral (");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, ", ");WriteI (file, yyt^.Leaf.recindex, 0);WriteS (file, ", xxGlobalRecoverySet); (* ");WriteRecIndex (file, yyt^.Leaf.recindex);WriteS (file, " *)");WriteNl (file);
  1022. Spaces;WriteS (file, "ELSE");WriteNl (file);
  1023. Spaces;WriteS (file, "  xxToken := ");
  1024.         Prefix;
  1025. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  1026. Spaces;WriteS (file, "END;");WriteNl (file);
  1027.           InDefault := FALSE;
  1028.         ELSE
  1029. Spaces;WriteS (file, "xxToken := ");
  1030.         Prefix;
  1031. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  1032.         END;
  1033.         
  1034. END yyF14CodeRules;
  1035.  
  1036. PROCEDURE yyF15CodeRules (yyt: Tree.tTree);
  1037.  
  1038. BEGIN    (* line 824   *)
  1039.  
  1040. Spaces;WriteS (file, "IF xxToken # ");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, " (* ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteS (file, " *) THEN");WriteNl (file);
  1041. Spaces;WriteS (file, "  xxRecoveryTerminal (");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, ", ");WriteI (file, yyt^.Leaf.recindex, 0);WriteS (file, ", xxGlobalRecoverySet, ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteI (file, yyt^.Leaf.number, 0);WriteS (file, "); (* ");WriteRecIndex (file, yyt^.Leaf.recindex);WriteS (file, " *)");WriteNl (file);
  1042. Spaces;WriteS (file, "ELSE");WriteNl (file);
  1043. Spaces;WriteS (file, "  ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteI (file, yyt^.Leaf.number, 0);WriteS (file, " := ");
  1044.         Prefix;
  1045. WriteS (file, ".Attribute;");WriteNl (file);
  1046. Spaces;WriteS (file, "  xxToken := ");
  1047.         Prefix;
  1048. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  1049. Spaces;WriteS (file, "END;");WriteNl (file);
  1050.         
  1051. END yyF15CodeRules;
  1052.  
  1053. PROCEDURE yyF16CodeRules (yyt: Tree.tTree);
  1054.  
  1055. BEGIN    (* line 839   *)
  1056.  
  1057. Spaces;WriteS (file, "IF xxToken # ");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, " (* ");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteS (file, " *) THEN");WriteNl (file);
  1058. Spaces;WriteS (file, "  xxRecoveryLiteral (");WriteI (file, Code (yyt^.Leaf.id^.Id.ident), 0);WriteS (file, ", ");WriteI (file, yyt^.Leaf.recindex, 0);WriteS (file, ", xxGlobalRecoverySet); (* ");WriteRecIndex (file, yyt^.Leaf.recindex);WriteS (file, " *)");WriteNl (file);
  1059. Spaces;WriteS (file, "ELSE");WriteNl (file);
  1060. Spaces;WriteS (file, "  xxToken := ");
  1061.         Prefix;
  1062. WriteS (file, ".GetToken (); xxIsRepairMode := FALSE;");WriteNl (file);
  1063. Spaces;WriteS (file, "END;");WriteNl (file);
  1064.         
  1065. END yyF16CodeRules;
  1066.  
  1067. PROCEDURE yyF17CodeRules (yyt: Tree.tTree);
  1068.  
  1069. BEGIN    (* line 851   *)
  1070.  
  1071. Spaces;WriteS (file, "xxUnion.LocalRecoverySet := ");WriteI (file, yyt^.Leaf.recindex, 0);WriteS (file, "; yy");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteS (file, " (");WriteIdent (file, yyt^.Leaf.id^.Id.ident);WriteI (file, yyt^.Leaf.number, 0);WriteS (file, ", SYSTEM.ADR (xxUnion)); (* ");WriteRecIndex (file, yyt^.Leaf.recindex);WriteS (file, " *)");WriteNl (file);
  1072.         
  1073. END yyF17CodeRules;
  1074.  
  1075. PROCEDURE yyF18CodeRules (yyt: Tree.tTree);
  1076.  
  1077. BEGIN
  1078. END yyF18CodeRules;
  1079.  
  1080. PROCEDURE yyF19CodeRules (yyt: Tree.tTree);
  1081.  
  1082. BEGIN    (* line 858   *)
  1083.  
  1084.         CodeRules (yyt^.Sequence.expr);
  1085.         CodeRules (yyt^.Sequence.sequence);
  1086.         
  1087. END yyF19CodeRules;
  1088.  
  1089. PROCEDURE yyF20CodeRules (yyt: Tree.tTree);
  1090.  
  1091. BEGIN    (* line 864   *)
  1092.  
  1093. Spaces;WriteS (file, "LOOP");WriteNl (file);
  1094. INC (SpaCo);
  1095. Spaces;WriteS (file, "CASE xxToken OF");WriteNl (file);
  1096.           CodeAltCase (yyt);
  1097. Spaces;WriteS (file, "END;");WriteNl (file);
  1098. DEC (SpaCo);
  1099. Spaces;WriteS (file, "END;");WriteNl (file);
  1100.         
  1101. END yyF20CodeRules;
  1102.  
  1103. PROCEDURE yyF21CodeRules (yyt: Tree.tTree);
  1104.  
  1105. BEGIN    (* line 875   *)
  1106.  
  1107.         CodeAltIf (yyt, FALSE);
  1108.         
  1109. END yyF21CodeRules;
  1110.  
  1111. PROCEDURE yyF22CodeAltCase (yyt: Tree.tTree);
  1112.  
  1113. BEGIN    (* line 883   *)
  1114.  
  1115. Spaces;WriteS (file, "ELSE");WriteNl (file);
  1116. INC (SpaCo);
  1117. Spaces;WriteS (file, "IF xxIsRepairMode THEN");WriteNl (file);
  1118. INC (SpaCo);
  1119.             InDefault := TRUE;
  1120.             CodeRules (yyt^.Alternative0.default);
  1121.             InDefault := FALSE;
  1122. Spaces;WriteS (file, "EXIT;");WriteNl (file);
  1123. DEC (SpaCo);
  1124. Spaces;WriteS (file, "END;");WriteNl (file);
  1125.           CodeRecovery (yyt^.Alternative0.recindex, yyt^.Alternative0.expindex);
  1126. DEC (SpaCo);
  1127.         
  1128. END yyF22CodeAltCase;
  1129.  
  1130. PROCEDURE yyF23CodeAltCase (yyt: Tree.tTree);
  1131.  
  1132. BEGIN    (* line 899   *)
  1133.  
  1134.         WriteLabels (yyt^.Alternative.expr^.expr.fifo);
  1135. INC (SpaCo);
  1136.         CodeRules (yyt^.Alternative.expr);
  1137. Spaces;WriteS (file, "EXIT;");WriteNl (file);
  1138. DEC (SpaCo);
  1139.         CodeAltCase (yyt^.Alternative.alternative);
  1140.         
  1141. END yyF23CodeAltCase;
  1142.  
  1143. PROCEDURE yyF24CodeAltIf (yyt: Tree.tTree;started:BOOLEAN);
  1144.  
  1145. BEGIN    (* line 912   *)
  1146.  
  1147. Spaces;WriteS (file, "ELSE");WriteNl (file);
  1148. INC (SpaCo);
  1149.           CodeRecovery (yyt^.Alternative0.recindex, yyt^.Alternative0.expindex);
  1150.           InDefault := TRUE;
  1151.           CodeRules (yyt^.Alternative0.default);
  1152.           InDefault := FALSE;
  1153. DEC (SpaCo);
  1154. Spaces;WriteS (file, "END;");WriteNl (file);
  1155.         
  1156. END yyF24CodeAltIf;
  1157.  
  1158. PROCEDURE yyF25CodeAltIf (yyt: Tree.tTree;started:BOOLEAN);
  1159.  
  1160. BEGIN    (* line 924   *)
  1161.  
  1162.         IF NOT started THEN
  1163. Spaces;WriteS (file, "IF ");
  1164.                 CodeIsElement (yyt^.Alternative.index, yyt^.Alternative.expr^.expr.first);
  1165. WriteS (file, " THEN");WriteNl (file);
  1166.         ELSE
  1167. Spaces;WriteS (file, "ELSE ");WriteNl (file);
  1168.         END;
  1169. INC (SpaCo);
  1170.         CodeRules (yyt^.Alternative.expr);
  1171. DEC (SpaCo);
  1172. Spaces;WriteS (file, "END;");WriteNl (file);
  1173.         
  1174. END yyF25CodeAltIf;
  1175.  
  1176. PROCEDURE yyF26CodeAltIf (yyt: Tree.tTree;started:BOOLEAN);
  1177.  
  1178. BEGIN    (* line 939   *)
  1179.  
  1180.         IF NOT started THEN
  1181. Spaces;WriteS (file, "IF ");
  1182.         ELSE
  1183. WriteS (file, "ELSIF ");
  1184.         END;
  1185.             CodeIsElement (yyt^.Alternative.index, yyt^.Alternative.expr^.expr.fifo);
  1186. WriteS (file, " THEN");WriteNl (file);
  1187. INC (SpaCo);
  1188.         CodeRules (yyt^.Alternative.expr);
  1189. DEC (SpaCo);
  1190.         CodeAltIf (yyt^.Alternative.alternative, TRUE);
  1191.         
  1192. END yyF26CodeAltIf;
  1193.  
  1194. PROCEDURE yyF27SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1195.  
  1196. BEGIN    (* line 961   *)
  1197.  
  1198.         IF start THEN ClearArray (NumberArray^); END;
  1199.         SetNumbers (yyt^.Option.expr, FALSE);
  1200.         
  1201. END yyF27SetNumbers;
  1202.  
  1203. PROCEDURE yyF28SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1204.  
  1205. BEGIN    (* line 967   *)
  1206.  
  1207.         IF start THEN ClearArray (NumberArray^); END;
  1208.         SetNumbers (yyt^.Times.expr, FALSE);
  1209.         
  1210. END yyF28SetNumbers;
  1211.  
  1212. PROCEDURE yyF29SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1213.  
  1214. BEGIN    (* line 973   *)
  1215.  
  1216.         IF start THEN ClearArray (NumberArray^); END;
  1217.         SetNumbers (yyt^.Plus.expr, FALSE);
  1218.         
  1219. END yyF29SetNumbers;
  1220.  
  1221. PROCEDURE yyF30SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1222.  
  1223. BEGIN    (* line 979   *)
  1224.  
  1225.         IF start THEN ClearArray (NumberArray^); END;
  1226.         SetNumbers (yyt^.List.body, FALSE);
  1227.         SetNumbers (yyt^.List.sep, FALSE);
  1228.         
  1229. END yyF30SetNumbers;
  1230.  
  1231. PROCEDURE yyF31SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1232.  
  1233. BEGIN
  1234. END yyF31SetNumbers;
  1235.  
  1236. PROCEDURE yyF32SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1237.  
  1238. BEGIN
  1239. END yyF32SetNumbers;
  1240.  
  1241. PROCEDURE yyF33SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1242.  
  1243. BEGIN    (* line 990   *)
  1244.  
  1245.         IF start THEN ClearArray (NumberArray^); END;
  1246.         SetNumbers (yyt^.Sequence.expr, FALSE);
  1247.         SetNumbers (yyt^.Sequence.sequence, FALSE);
  1248.         
  1249. END yyF33SetNumbers;
  1250.  
  1251. PROCEDURE yyF34SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1252.  
  1253. BEGIN    (* line 996   *)
  1254.  
  1255. END yyF34SetNumbers;
  1256.  
  1257. PROCEDURE yyF35SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1258.  
  1259. BEGIN    (* line 999   *)
  1260.  
  1261.         IF start THEN ClearArray (NumberArray^); END;
  1262.         SetNumbers (yyt^.Alternative.expr, FALSE);
  1263.         SetNumbers (yyt^.Alternative.alternative, start);
  1264.         
  1265. END yyF35SetNumbers;
  1266.  
  1267. PROCEDURE yyF36SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1268.  
  1269. BEGIN    (* line 1007   *)
  1270.  
  1271.         yyt^.Leaf.number := 0;
  1272.         
  1273. END yyF36SetNumbers;
  1274.  
  1275. PROCEDURE yyF37SetNumbers (yyt: Tree.tTree;start:BOOLEAN);
  1276.  
  1277. BEGIN    (* line 1013   *)
  1278.  
  1279.         IF start THEN ClearArray (NumberArray^); END;
  1280.         yyt^.Leaf.number := NumberArray^ [yyt^.Leaf.id^.Id.ident] + 1;
  1281.         NumberArray^ [yyt^.Leaf.id^.Id.ident] := yyt^.Leaf.number;
  1282.         IF yyt^.Leaf.number > MaxNumberArray^ [yyt^.Leaf.id^.Id.ident] THEN
  1283.           MaxNumberArray^ [yyt^.Leaf.id^.Id.ident] := yyt^.Leaf.number;
  1284.         END;
  1285.         
  1286. END yyF37SetNumbers;
  1287.  
  1288. PROCEDURE yyF38CodeExport (yyt: Tree.tTree);
  1289.  
  1290. BEGIN    (* line 1031   *)
  1291.  
  1292.         vExport := TRUE;
  1293.         CodeCodes (yyt^.Sections.section^.Export.codes);
  1294.         CodeExport (yyt^.Sections.sections);
  1295.         
  1296. END yyF38CodeExport;
  1297.  
  1298. PROCEDURE yyF39CodeExport (yyt: Tree.tTree);
  1299.  
  1300. BEGIN    (* line 1039   *)
  1301.  
  1302.         CodeExport (yyt^.Sections.sections);
  1303.         
  1304. END yyF39CodeExport;
  1305.  
  1306. PROCEDURE yyF40CodeExport (yyt: Tree.tTree);
  1307.  
  1308. BEGIN
  1309. END yyF40CodeExport;
  1310.  
  1311. PROCEDURE yyF41CodeGlobal (yyt: Tree.tTree);
  1312.  
  1313. BEGIN    (* line 1050   *)
  1314.  
  1315.         CodeCodes (yyt^.Sections.section^.Global.codes);
  1316.         CodeGlobal (yyt^.Sections.sections);
  1317.         
  1318. END yyF41CodeGlobal;
  1319.  
  1320. PROCEDURE yyF42CodeGlobal (yyt: Tree.tTree);
  1321.  
  1322. BEGIN    (* line 1057   *)
  1323.  
  1324.         CodeGlobal (yyt^.Sections.sections);
  1325.         
  1326. END yyF42CodeGlobal;
  1327.  
  1328. PROCEDURE yyF43CodeGlobal (yyt: Tree.tTree);
  1329.  
  1330. BEGIN
  1331. END yyF43CodeGlobal;
  1332.  
  1333. PROCEDURE yyF44CodeLocal (yyt: Tree.tTree);
  1334.  
  1335. BEGIN    (* line 1068   *)
  1336.  
  1337.         CodeCodes (yyt^.Sections.section^.Local.codes);
  1338.         CodeLocal (yyt^.Sections.sections);
  1339.         
  1340. END yyF44CodeLocal;
  1341.  
  1342. PROCEDURE yyF45CodeLocal (yyt: Tree.tTree);
  1343.  
  1344. BEGIN    (* line 1075   *)
  1345.  
  1346.         CodeLocal (yyt^.Sections.sections);
  1347.         
  1348. END yyF45CodeLocal;
  1349.  
  1350. PROCEDURE yyF46CodeLocal (yyt: Tree.tTree);
  1351.  
  1352. BEGIN
  1353. END yyF46CodeLocal;
  1354.  
  1355. PROCEDURE yyF47CodeBegin (yyt: Tree.tTree);
  1356.  
  1357. BEGIN    (* line 1086   *)
  1358.  
  1359.         CodeCodes (yyt^.Sections.section^.Begin.codes);
  1360.         CodeBegin (yyt^.Sections.sections);
  1361.         
  1362. END yyF47CodeBegin;
  1363.  
  1364. PROCEDURE yyF48CodeBegin (yyt: Tree.tTree);
  1365.  
  1366. BEGIN    (* line 1093   *)
  1367.  
  1368.         CodeBegin (yyt^.Sections.sections);
  1369.         
  1370. END yyF48CodeBegin;
  1371.  
  1372. PROCEDURE yyF49CodeBegin (yyt: Tree.tTree);
  1373.  
  1374. BEGIN
  1375. END yyF49CodeBegin;
  1376.  
  1377. PROCEDURE yyF50CodeClose (yyt: Tree.tTree);
  1378.  
  1379. BEGIN    (* line 1104   *)
  1380.  
  1381.         CodeCodes (yyt^.Sections.section^.Close.codes);
  1382.         CodeClose (yyt^.Sections.sections);
  1383.         
  1384. END yyF50CodeClose;
  1385.  
  1386. PROCEDURE yyF51CodeClose (yyt: Tree.tTree);
  1387.  
  1388. BEGIN    (* line 1111   *)
  1389.  
  1390.         CodeClose (yyt^.Sections.sections);
  1391.         
  1392. END yyF51CodeClose;
  1393.  
  1394. PROCEDURE yyF52CodeClose (yyt: Tree.tTree);
  1395.  
  1396. BEGIN
  1397. END yyF52CodeClose;
  1398.  
  1399. PROCEDURE yyF53CodeCodes (yyt: Tree.tTree);
  1400.  
  1401. BEGIN    (* line 1121   *)
  1402.  
  1403.  
  1404. WriteS (file, "(* '");WriteS (file, SourceFileName);WriteS (file, "' line ");WriteI (file, yyt^.Codes.code^.Code.pos.Line, 0);WriteS (file, " *)");WriteNl (file);
  1405.         WriteString (file, yyt^.Codes.code^.Code.ref);
  1406.         CodeCodes2 (yyt^.Codes.codes);
  1407. WriteNl (file);
  1408.  
  1409.         
  1410. END yyF53CodeCodes;
  1411.  
  1412. PROCEDURE yyF54CodeCodes (yyt: Tree.tTree);
  1413.  
  1414. BEGIN
  1415. END yyF54CodeCodes;
  1416.  
  1417. PROCEDURE yyF55CodeCodes2 (yyt: Tree.tTree);
  1418.  
  1419. BEGIN    (* line 1136   *)
  1420.  
  1421.         WriteString (file, yyt^.Codes.code^.Code.ref);
  1422.         CodeCodes2 (yyt^.Codes.codes);
  1423.         
  1424. END yyF55CodeCodes2;
  1425.  
  1426. PROCEDURE yyF56CodeCodes2 (yyt: Tree.tTree);
  1427.  
  1428. BEGIN
  1429. END yyF56CodeCodes2;
  1430.  
  1431. PROCEDURE CostCODE (yyt: Tree.tTree): INTEGER;
  1432. VAR
  1433.   InfoPtr: yyInfoPtr;
  1434. BEGIN
  1435.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1436.   RETURN InfoPtr^.CODE.Cost;
  1437. END CostCODE;
  1438.  
  1439. PROCEDURE CostCodeDef (yyt: Tree.tTree): INTEGER;
  1440. VAR
  1441.   InfoPtr: yyInfoPtr;
  1442. BEGIN
  1443.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1444.   RETURN InfoPtr^.CodeDef.Cost;
  1445. END CostCodeDef;
  1446.  
  1447. PROCEDURE CostCodeImp (yyt: Tree.tTree): INTEGER;
  1448. VAR
  1449.   InfoPtr: yyInfoPtr;
  1450. BEGIN
  1451.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1452.   RETURN InfoPtr^.CodeImp.Cost;
  1453. END CostCodeImp;
  1454.  
  1455. PROCEDURE CostCodeRules (yyt: Tree.tTree): INTEGER;
  1456. VAR
  1457.   InfoPtr: yyInfoPtr;
  1458. BEGIN
  1459.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1460.   RETURN InfoPtr^.CodeRules.Cost;
  1461. END CostCodeRules;
  1462.  
  1463. PROCEDURE CostCodeAltCase (yyt: Tree.tTree): INTEGER;
  1464. VAR
  1465.   InfoPtr: yyInfoPtr;
  1466. BEGIN
  1467.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1468.   RETURN InfoPtr^.CodeAltCase.Cost;
  1469. END CostCodeAltCase;
  1470.  
  1471. PROCEDURE CostCodeAltIf (yyt: Tree.tTree): INTEGER;
  1472. VAR
  1473.   InfoPtr: yyInfoPtr;
  1474. BEGIN
  1475.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1476.   RETURN InfoPtr^.CodeAltIf.Cost;
  1477. END CostCodeAltIf;
  1478.  
  1479. PROCEDURE CostSetNumbers (yyt: Tree.tTree): INTEGER;
  1480. VAR
  1481.   InfoPtr: yyInfoPtr;
  1482. BEGIN
  1483.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1484.   RETURN InfoPtr^.SetNumbers.Cost;
  1485. END CostSetNumbers;
  1486.  
  1487. PROCEDURE CostCodeExport (yyt: Tree.tTree): INTEGER;
  1488. VAR
  1489.   InfoPtr: yyInfoPtr;
  1490. BEGIN
  1491.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1492.   RETURN InfoPtr^.CodeExport.Cost;
  1493. END CostCodeExport;
  1494.  
  1495. PROCEDURE CostCodeGlobal (yyt: Tree.tTree): INTEGER;
  1496. VAR
  1497.   InfoPtr: yyInfoPtr;
  1498. BEGIN
  1499.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1500.   RETURN InfoPtr^.CodeGlobal.Cost;
  1501. END CostCodeGlobal;
  1502.  
  1503. PROCEDURE CostCodeLocal (yyt: Tree.tTree): INTEGER;
  1504. VAR
  1505.   InfoPtr: yyInfoPtr;
  1506. BEGIN
  1507.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1508.   RETURN InfoPtr^.CodeLocal.Cost;
  1509. END CostCodeLocal;
  1510.  
  1511. PROCEDURE CostCodeBegin (yyt: Tree.tTree): INTEGER;
  1512. VAR
  1513.   InfoPtr: yyInfoPtr;
  1514. BEGIN
  1515.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1516.   RETURN InfoPtr^.CodeBegin.Cost;
  1517. END CostCodeBegin;
  1518.  
  1519. PROCEDURE CostCodeClose (yyt: Tree.tTree): INTEGER;
  1520. VAR
  1521.   InfoPtr: yyInfoPtr;
  1522. BEGIN
  1523.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1524.   RETURN InfoPtr^.CodeClose.Cost;
  1525. END CostCodeClose;
  1526.  
  1527. PROCEDURE CostCodeCodes (yyt: Tree.tTree): INTEGER;
  1528. VAR
  1529.   InfoPtr: yyInfoPtr;
  1530. BEGIN
  1531.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1532.   RETURN InfoPtr^.CodeCodes.Cost;
  1533. END CostCodeCodes;
  1534.  
  1535. PROCEDURE CostCodeCodes2 (yyt: Tree.tTree): INTEGER;
  1536. VAR
  1537.   InfoPtr: yyInfoPtr;
  1538. BEGIN
  1539.   InfoPtr := yyt^.yyHead.yyEstraInfo;
  1540.   RETURN InfoPtr^.CodeCodes2.Cost;
  1541. END CostCodeCodes2;
  1542.  
  1543. PROCEDURE yyTraverse (yyt: Tree.tTree): yyStateType;
  1544. VAR
  1545.   state: yyStateType;
  1546.   match: POINTER TO yySetType;
  1547.   cost: INTEGER;
  1548.   info: yyInfoPtr;
  1549.   success: BOOLEAN;
  1550.   
  1551. BEGIN
  1552.   info := yyAlloc ();
  1553.   info^ := yyInfo;
  1554.   yyt^.yyHead.yyEstraInfo := info;
  1555.   
  1556.   
  1557.   CASE yyt^.Kind OF
  1558.   
  1559.   | Tree.Codes:
  1560.       state := 0;
  1561.       state := yyComb [state + yyTraverse (yyt^.Codes.code)];
  1562.       state := yyComb [state + yyTraverse (yyt^.Codes.codes)];
  1563.  
  1564.       cost := 1
  1565.       + CostCodeCodes2 (yyt^.Codes.codes);
  1566.       IF cost < info^.CodeCodes.Cost THEN
  1567.         info^.CodeCodes.Cost := cost;
  1568.         info^.CodeCodes.Proc := yyF53CodeCodes;
  1569.       END;
  1570.       
  1571.       cost := 1
  1572.       + CostCodeCodes2 (yyt^.Codes.codes);
  1573.       IF cost < info^.CodeCodes2.Cost THEN
  1574.         info^.CodeCodes2.Cost := cost;
  1575.         info^.CodeCodes2.Proc := yyF55CodeCodes2;
  1576.       END;
  1577.       
  1578.   | Tree.Code:
  1579.       state := 32;
  1580.  
  1581.   | Tree.Close:
  1582.       state := 3;
  1583.       state := yyComb [state + yyTraverse (yyt^.Close.codes)];
  1584.  
  1585.   | Tree.Grammar:
  1586.       state := 18;
  1587.       state := yyComb [state + yyTraverse (yyt^.Grammar.sections)];
  1588.       state := yyComb [state + yyTraverse (yyt^.Grammar.tokens)];
  1589.       state := yyComb [state + yyTraverse (yyt^.Grammar.rules)];
  1590.       match := SYSTEM.ADR (yySets [state]);
  1591.       
  1592.       yyMatch [3] := (3 IN match^[0]);
  1593.       yyMatch [4] := (4 IN match^[0]);
  1594.  
  1595.       cost := 1
  1596.       + CostCodeExport (yyt^.Grammar.sections);
  1597.       IF cost < info^.CodeDef.Cost THEN
  1598.         info^.CodeDef.Cost := cost;
  1599.         info^.CodeDef.Proc := yyF2CodeDef;
  1600.       END;
  1601.       
  1602.       IF yyMatch [3] THEN
  1603.         cost := 1
  1604.         + CostCodeGlobal (yyt^.Grammar.sections)
  1605.         + CostCodeBegin (yyt^.Grammar.sections)
  1606.         + CostCodeClose (yyt^.Grammar.sections)
  1607.         + CostCodeRules (yyt^.Grammar.rules);
  1608.         IF cost < info^.CodeImp.Cost THEN
  1609.           info^.CodeImp.Cost := cost;
  1610.           info^.CodeImp.Proc := yyF3CodeImp;
  1611.         END;
  1612.       END;
  1613.       
  1614.       IF yyMatch [4] THEN
  1615.         cost := 1;
  1616.         IF cost < info^.CodeImp.Cost THEN
  1617.           info^.CodeImp.Cost := cost;
  1618.           info^.CodeImp.Proc := yyF4CodeImp;
  1619.         END;
  1620.       END;
  1621.       
  1622.       cost := 1
  1623.       + CostCodeDef (yyt)
  1624.       + CostCodeImp (yyt);
  1625.       IF cost < info^.CODE.Cost THEN
  1626.         info^.CODE.Cost := cost;
  1627.         info^.CODE.Proc := yyF1CODE;
  1628.       END;
  1629.       
  1630.   | Tree.Sections0:
  1631.       state := 24;
  1632.  
  1633.       cost := 1;
  1634.       IF cost < info^.CodeExport.Cost THEN
  1635.         info^.CodeExport.Cost := cost;
  1636.         info^.CodeExport.Proc := yyF40CodeExport;
  1637.       END;
  1638.       
  1639.       cost := 1;
  1640.       IF cost < info^.CodeGlobal.Cost THEN
  1641.         info^.CodeGlobal.Cost := cost;
  1642.         info^.CodeGlobal.Proc := yyF43CodeGlobal;
  1643.       END;
  1644.       
  1645.       cost := 1;
  1646.       IF cost < info^.CodeLocal.Cost THEN
  1647.         info^.CodeLocal.Cost := cost;
  1648.         info^.CodeLocal.Proc := yyF46CodeLocal;
  1649.       END;
  1650.       
  1651.       cost := 1;
  1652.       IF cost < info^.CodeBegin.Cost THEN
  1653.         info^.CodeBegin.Cost := cost;
  1654.         info^.CodeBegin.Proc := yyF49CodeBegin;
  1655.       END;
  1656.       
  1657.       cost := 1;
  1658.       IF cost < info^.CodeClose.Cost THEN
  1659.         info^.CodeClose.Cost := cost;
  1660.         info^.CodeClose.Proc := yyF52CodeClose;
  1661.       END;
  1662.       
  1663.   | Tree.Sections:
  1664.       state := 17;
  1665.       state := yyComb [state + yyTraverse (yyt^.Sections.section)];
  1666.       state := yyComb [state + yyTraverse (yyt^.Sections.sections)];
  1667.       match := SYSTEM.ADR (yySets [state]);
  1668.       
  1669.       yyMatch [38] := (6 IN match^[1]);
  1670.       yyMatch [39] := TRUE & (          (* line 1038   *)
  1671.  yyt^.Sections.section^.Kind # Tree.Export );
  1672.       yyMatch [41] := (9 IN match^[1]);
  1673.       yyMatch [42] := TRUE & (          (* line 1056   *)
  1674.  yyt^.Sections.section^.Kind # Tree.Global );
  1675.       yyMatch [44] := (12 IN match^[1]);
  1676.       yyMatch [45] := TRUE & (          (* line 1074   *)
  1677.  yyt^.Sections.section^.Kind # Tree.Local );
  1678.       yyMatch [47] := (15 IN match^[1]);
  1679.       yyMatch [48] := TRUE & (          (* line 1092   *)
  1680.  yyt^.Sections.section^.Kind # Tree.Begin );
  1681.       yyMatch [50] := (18 IN match^[1]);
  1682.       yyMatch [51] := TRUE & (          (* line 1110   *)
  1683.  yyt^.Sections.section^.Kind # Tree.Close );
  1684.  
  1685.       IF yyMatch [38] THEN
  1686.         cost := 1
  1687.         + CostCodeCodes (yyt^.Sections.section^.Export.codes)
  1688.         + CostCodeExport (yyt^.Sections.sections);
  1689.         IF cost < info^.CodeExport.Cost THEN
  1690.           info^.CodeExport.Cost := cost;
  1691.           info^.CodeExport.Proc := yyF38CodeExport;
  1692.         END;
  1693.       END;
  1694.       
  1695.       IF yyMatch [39] THEN
  1696.         cost := 1
  1697.         + CostCodeExport (yyt^.Sections.sections);
  1698.         IF cost < info^.CodeExport.Cost THEN
  1699.           info^.CodeExport.Cost := cost;
  1700.           info^.CodeExport.Proc := yyF39CodeExport;
  1701.         END;
  1702.       END;
  1703.       
  1704.       IF yyMatch [41] THEN
  1705.         cost := 1
  1706.         + CostCodeCodes (yyt^.Sections.section^.Global.codes)
  1707.         + CostCodeGlobal (yyt^.Sections.sections);
  1708.         IF cost < info^.CodeGlobal.Cost THEN
  1709.           info^.CodeGlobal.Cost := cost;
  1710.           info^.CodeGlobal.Proc := yyF41CodeGlobal;
  1711.         END;
  1712.       END;
  1713.       
  1714.       IF yyMatch [42] THEN
  1715.         cost := 1
  1716.         + CostCodeGlobal (yyt^.Sections.sections);
  1717.         IF cost < info^.CodeGlobal.Cost THEN
  1718.           info^.CodeGlobal.Cost := cost;
  1719.           info^.CodeGlobal.Proc := yyF42CodeGlobal;
  1720.         END;
  1721.       END;
  1722.       
  1723.       IF yyMatch [44] THEN
  1724.         cost := 1
  1725.         + CostCodeCodes (yyt^.Sections.section^.Local.codes)
  1726.         + CostCodeLocal (yyt^.Sections.sections);
  1727.         IF cost < info^.CodeLocal.Cost THEN
  1728.           info^.CodeLocal.Cost := cost;
  1729.           info^.CodeLocal.Proc := yyF44CodeLocal;
  1730.         END;
  1731.       END;
  1732.       
  1733.       IF yyMatch [45] THEN
  1734.         cost := 1
  1735.         + CostCodeLocal (yyt^.Sections.sections);
  1736.         IF cost < info^.CodeLocal.Cost THEN
  1737.           info^.CodeLocal.Cost := cost;
  1738.           info^.CodeLocal.Proc := yyF45CodeLocal;
  1739.         END;
  1740.       END;
  1741.       
  1742.       IF yyMatch [47] THEN
  1743.         cost := 1
  1744.         + CostCodeCodes (yyt^.Sections.section^.Begin.codes)
  1745.         + CostCodeBegin (yyt^.Sections.sections);
  1746.         IF cost < info^.CodeBegin.Cost THEN
  1747.           info^.CodeBegin.Cost := cost;
  1748.           info^.CodeBegin.Proc := yyF47CodeBegin;
  1749.         END;
  1750.       END;
  1751.       
  1752.       IF yyMatch [48] THEN
  1753.         cost := 1
  1754.         + CostCodeBegin (yyt^.Sections.sections);
  1755.         IF cost < info^.CodeBegin.Cost THEN
  1756.           info^.CodeBegin.Cost := cost;
  1757.           info^.CodeBegin.Proc := yyF48CodeBegin;
  1758.         END;
  1759.       END;
  1760.       
  1761.       IF yyMatch [50] THEN
  1762.         cost := 1
  1763.         + CostCodeCodes (yyt^.Sections.section^.Close.codes)
  1764.         + CostCodeClose (yyt^.Sections.sections);
  1765.         IF cost < info^.CodeClose.Cost THEN
  1766.           info^.CodeClose.Cost := cost;
  1767.           info^.CodeClose.Proc := yyF50CodeClose;
  1768.         END;
  1769.       END;
  1770.       
  1771.       IF yyMatch [51] THEN
  1772.         cost := 1
  1773.         + CostCodeClose (yyt^.Sections.sections);
  1774.         IF cost < info^.CodeClose.Cost THEN
  1775.           info^.CodeClose.Cost := cost;
  1776.           info^.CodeClose.Proc := yyF51CodeClose;
  1777.         END;
  1778.       END;
  1779.       
  1780.   | Tree.Export:
  1781.       state := 85;
  1782.       state := yyComb [state + yyTraverse (yyt^.Export.codes)];
  1783.  
  1784.   | Tree.Global:
  1785.       state := 87;
  1786.       state := yyComb [state + yyTraverse (yyt^.Global.codes)];
  1787.  
  1788.   | Tree.Local:
  1789.       state := 89;
  1790.       state := yyComb [state + yyTraverse (yyt^.Local.codes)];
  1791.  
  1792.   | Tree.Begin:
  1793.       state := 97;
  1794.       state := yyComb [state + yyTraverse (yyt^.Begin.codes)];
  1795.  
  1796.   | Tree.Codes0:
  1797.       state := 26;
  1798.  
  1799.       cost := 1;
  1800.       IF cost < info^.CodeCodes.Cost THEN
  1801.         info^.CodeCodes.Cost := cost;
  1802.         info^.CodeCodes.Proc := yyF54CodeCodes;
  1803.       END;
  1804.       
  1805.       cost := 1;
  1806.       IF cost < info^.CodeCodes2.Cost THEN
  1807.         info^.CodeCodes2.Cost := cost;
  1808.         info^.CodeCodes2.Proc := yyF56CodeCodes2;
  1809.       END;
  1810.       
  1811.   | Tree.Tokens0:
  1812.       state := 32;
  1813.  
  1814.   | Tree.Tokens:
  1815.       state := 99;
  1816.       state := yyComb [state + yyTraverse (yyt^.Tokens.token)];
  1817.       state := yyComb [state + yyTraverse (yyt^.Tokens.tokens)];
  1818.  
  1819.   | Tree.Token:
  1820.       state := 99;
  1821.       state := yyComb [state + yyTraverse (yyt^.Token.id)];
  1822.       state := yyComb [state + yyTraverse (yyt^.Token.number)];
  1823.  
  1824.   | Tree.Id:
  1825.       state := 32;
  1826.  
  1827.   | Tree.Number:
  1828.       state := 32;
  1829.  
  1830.   | Tree.Rules0:
  1831.       state := 3;
  1832.  
  1833.       cost := 1;
  1834.       IF cost < info^.CodeRules.Cost THEN
  1835.         info^.CodeRules.Cost := cost;
  1836.         info^.CodeRules.Proc := yyF5CodeRules;
  1837.       END;
  1838.       
  1839.   | Tree.Rules:
  1840.       state := 34;
  1841.       state := yyComb [state + yyTraverse (yyt^.Rules.rule)];
  1842.       state := yyComb [state + yyTraverse (yyt^.Rules.rules)];
  1843.  
  1844.       cost := 1
  1845.       + CostCodeCodes (yyt^.Rules.rule^.Rule.codes)
  1846.       + CostSetNumbers (yyt^.Rules.rule^.Rule.expr)
  1847.       + CostCodeRules (yyt^.Rules.rule^.Rule.expr)
  1848.       + CostCodeRules (yyt^.Rules.rules);
  1849.       IF cost < info^.CodeRules.Cost THEN
  1850.         info^.CodeRules.Cost := cost;
  1851.         info^.CodeRules.Proc := yyF6CodeRules;
  1852.       END;
  1853.       
  1854.   | Tree.Rule:
  1855.       state := 35;
  1856.       state := yyComb [state + yyTraverse (yyt^.Rule.id)];
  1857.       state := yyComb [state + yyTraverse (yyt^.Rule.codes)];
  1858.       state := yyComb [state + yyTraverse (yyt^.Rule.expr)];
  1859.  
  1860.   | Tree.Option:
  1861.       state := 140;
  1862.       state := yyComb [state + yyTraverse (yyt^.Option.expr)];
  1863.  
  1864.       cost := 1
  1865.       + CostCodeRules (yyt^.Option.expr);
  1866.       IF cost < info^.CodeRules.Cost THEN
  1867.         info^.CodeRules.Cost := cost;
  1868.         info^.CodeRules.Proc := yyF7CodeRules;
  1869.       END;
  1870.       
  1871.       cost := 1
  1872.       + CostSetNumbers (yyt^.Option.expr);
  1873.       IF cost < info^.SetNumbers.Cost THEN
  1874.         info^.SetNumbers.Cost := cost;
  1875.         info^.SetNumbers.Proc := yyF27SetNumbers;
  1876.       END;
  1877.       
  1878.   | Tree.Times:
  1879.       state := 168;
  1880.       state := yyComb [state + yyTraverse (yyt^.Times.expr)];
  1881.  
  1882.       cost := 1
  1883.       + CostCodeRules (yyt^.Times.expr);
  1884.       IF cost < info^.CodeRules.Cost THEN
  1885.         info^.CodeRules.Cost := cost;
  1886.         info^.CodeRules.Proc := yyF8CodeRules;
  1887.       END;
  1888.       
  1889.       cost := 1
  1890.       + CostSetNumbers (yyt^.Times.expr);
  1891.       IF cost < info^.SetNumbers.Cost THEN
  1892.         info^.SetNumbers.Cost := cost;
  1893.         info^.SetNumbers.Proc := yyF28SetNumbers;
  1894.       END;
  1895.       
  1896.   | Tree.Plus:
  1897.       state := 181;
  1898.       state := yyComb [state + yyTraverse (yyt^.Plus.expr)];
  1899.  
  1900.       cost := 1
  1901.       + CostCodeRules (yyt^.Plus.expr);
  1902.       IF cost < info^.CodeRules.Cost THEN
  1903.         info^.CodeRules.Cost := cost;
  1904.         info^.CodeRules.Proc := yyF9CodeRules;
  1905.       END;
  1906.       
  1907.       cost := 1
  1908.       + CostSetNumbers (yyt^.Plus.expr);
  1909.       IF cost < info^.SetNumbers.Cost THEN
  1910.         info^.SetNumbers.Cost := cost;
  1911.         info^.SetNumbers.Proc := yyF29SetNumbers;
  1912.       END;
  1913.       
  1914.   | Tree.List:
  1915.       state := 209;
  1916.       state := yyComb [state + yyTraverse (yyt^.List.body)];
  1917.       state := yyComb [state + yyTraverse (yyt^.List.sep)];
  1918.  
  1919.       cost := 1
  1920.       + CostCodeRules (yyt^.List.body)
  1921.       + CostCodeRules (yyt^.List.sep);
  1922.       IF cost < info^.CodeRules.Cost THEN
  1923.         info^.CodeRules.Cost := cost;
  1924.         info^.CodeRules.Proc := yyF10CodeRules;
  1925.       END;
  1926.       
  1927.       cost := 1
  1928.       + CostSetNumbers (yyt^.List.body)
  1929.       + CostSetNumbers (yyt^.List.sep);
  1930.       IF cost < info^.SetNumbers.Cost THEN
  1931.         info^.SetNumbers.Cost := cost;
  1932.         info^.SetNumbers.Proc := yyF30SetNumbers;
  1933.       END;
  1934.       
  1935.   | Tree.Action:
  1936.       state := 135;
  1937.       state := yyComb [state + yyTraverse (yyt^.Action.codes)];
  1938.       match := SYSTEM.ADR (yySets [state]);
  1939.       
  1940.       yyMatch [11] := (11 IN match^[0]);
  1941.  
  1942.       IF yyMatch [11] THEN
  1943.         cost := 1;
  1944.         IF cost < info^.CodeRules.Cost THEN
  1945.           info^.CodeRules.Cost := cost;
  1946.           info^.CodeRules.Proc := yyF11CodeRules;
  1947.         END;
  1948.       END;
  1949.       
  1950.       cost := 1
  1951.       + CostCodeCodes (yyt^.Action.codes);
  1952.       IF cost < info^.CodeRules.Cost THEN
  1953.         info^.CodeRules.Cost := cost;
  1954.         info^.CodeRules.Proc := yyF12CodeRules;
  1955.       END;
  1956.       
  1957.       cost := 1;
  1958.       IF cost < info^.SetNumbers.Cost THEN
  1959.         info^.SetNumbers.Cost := cost;
  1960.         info^.SetNumbers.Proc := yyF31SetNumbers;
  1961.       END;
  1962.       
  1963.   | Tree.Leaf:
  1964.       state := 36;
  1965.       state := yyComb [state + yyTraverse (yyt^.Leaf.id)];
  1966.       yyMatch [13] := TRUE & (          (* line 779   *)
  1967.  IsTerm (yyt^.Leaf.id^.Id.ident) & yyt^.Leaf.sure & NOT yyt^.Leaf.id^.Id.isstring );
  1968.       yyMatch [14] := TRUE & (          (* line 804   *)
  1969.  IsTerm (yyt^.Leaf.id^.Id.ident) & yyt^.Leaf.sure & yyt^.Leaf.id^.Id.isstring );
  1970.       yyMatch [15] := TRUE & (          (* line 823   *)
  1971.  IsTerm (yyt^.Leaf.id^.Id.ident) & NOT yyt^.Leaf.sure & NOT yyt^.Leaf.id^.Id.isstring );
  1972.       yyMatch [16] := TRUE & (          (* line 838   *)
  1973.  IsTerm (yyt^.Leaf.id^.Id.ident) & NOT yyt^.Leaf.sure & yyt^.Leaf.id^.Id.isstring );
  1974.       yyMatch [17] := TRUE & (          (* line 850   *)
  1975.  IsNonterm (yyt^.Leaf.id^.Id.ident) );
  1976.       yyMatch [36] := TRUE & (          (* line 1006   *)
  1977.  yyt^.Leaf.id^.Id.isstring );
  1978.       yyMatch [37] := TRUE & (          (* line 1012   *)
  1979.  NOT yyt^.Leaf.id^.Id.isstring );
  1980.  
  1981.       IF yyMatch [13] THEN
  1982.         cost := 1;
  1983.         IF cost < info^.CodeRules.Cost THEN
  1984.           info^.CodeRules.Cost := cost;
  1985.           info^.CodeRules.Proc := yyF13CodeRules;
  1986.         END;
  1987.       END;
  1988.       
  1989.       IF yyMatch [14] THEN
  1990.         cost := 1;
  1991.         IF cost < info^.CodeRules.Cost THEN
  1992.           info^.CodeRules.Cost := cost;
  1993.           info^.CodeRules.Proc := yyF14CodeRules;
  1994.         END;
  1995.       END;
  1996.       
  1997.       IF yyMatch [15] THEN
  1998.         cost := 1;
  1999.         IF cost < info^.CodeRules.Cost THEN
  2000.           info^.CodeRules.Cost := cost;
  2001.           info^.CodeRules.Proc := yyF15CodeRules;
  2002.         END;
  2003.       END;
  2004.       
  2005.       IF yyMatch [16] THEN
  2006.         cost := 1;
  2007.         IF cost < info^.CodeRules.Cost THEN
  2008.           info^.CodeRules.Cost := cost;
  2009.           info^.CodeRules.Proc := yyF16CodeRules;
  2010.         END;
  2011.       END;
  2012.       
  2013.       IF yyMatch [17] THEN
  2014.         cost := 1;
  2015.         IF cost < info^.CodeRules.Cost THEN
  2016.           info^.CodeRules.Cost := cost;
  2017.           info^.CodeRules.Proc := yyF17CodeRules;
  2018.         END;
  2019.       END;
  2020.       
  2021.       IF yyMatch [36] THEN
  2022.         cost := 1;
  2023.         IF cost < info^.SetNumbers.Cost THEN
  2024.           info^.SetNumbers.Cost := cost;
  2025.           info^.SetNumbers.Proc := yyF36SetNumbers;
  2026.         END;
  2027.       END;
  2028.       
  2029.       IF yyMatch [37] THEN
  2030.         cost := 1;
  2031.         IF cost < info^.SetNumbers.Cost THEN
  2032.           info^.SetNumbers.Cost := cost;
  2033.           info^.SetNumbers.Proc := yyF37SetNumbers;
  2034.         END;
  2035.       END;
  2036.       
  2037.   | Tree.Alternative0:
  2038.       state := 14;
  2039.       yyMatch [20] := TRUE & (          (* line 863   *)
  2040.  yyt^.alternative.case );
  2041.       yyMatch [21] := TRUE & (          (* line 874   *)
  2042.  NOT yyt^.alternative.case );
  2043.  
  2044.       cost := 1;
  2045.       IF cost < info^.CodeAltCase.Cost THEN
  2046.         info^.CodeAltCase.Cost := cost;
  2047.         info^.CodeAltCase.Proc := yyF22CodeAltCase;
  2048.       END;
  2049.       
  2050.       cost := 1;
  2051.       IF cost < info^.CodeAltIf.Cost THEN
  2052.         info^.CodeAltIf.Cost := cost;
  2053.         info^.CodeAltIf.Proc := yyF24CodeAltIf;
  2054.       END;
  2055.       
  2056.       cost := 1;
  2057.       IF cost < info^.SetNumbers.Cost THEN
  2058.         info^.SetNumbers.Cost := cost;
  2059.         info^.SetNumbers.Proc := yyF34SetNumbers;
  2060.       END;
  2061.       
  2062.       REPEAT
  2063.         success := FALSE;
  2064.         IF yyMatch [20] THEN
  2065.           cost := 1
  2066.           + CostCodeAltCase (yyt);
  2067.           IF cost < info^.CodeRules.Cost THEN
  2068.             info^.CodeRules.Cost := cost;
  2069.             info^.CodeRules.Proc := yyF20CodeRules;
  2070.             success := TRUE;
  2071.           END;
  2072.         END;
  2073.         
  2074.         IF yyMatch [21] THEN
  2075.           cost := 1
  2076.           + CostCodeAltIf (yyt);
  2077.           IF cost < info^.CodeRules.Cost THEN
  2078.             info^.CodeRules.Cost := cost;
  2079.             info^.CodeRules.Proc := yyF21CodeRules;
  2080.             success := TRUE;
  2081.           END;
  2082.         END;
  2083.         
  2084.       UNTIL NOT success;
  2085.   | Tree.Alternative:
  2086.       state := 250;
  2087.       state := yyComb [state + yyTraverse (yyt^.Alternative.expr)];
  2088.       state := yyComb [state + yyTraverse (yyt^.Alternative.alternative)];
  2089.       match := SYSTEM.ADR (yySets [state]);
  2090.       
  2091.       yyMatch [20] := TRUE & (          (* line 863   *)
  2092.  yyt^.alternative.case );
  2093.       yyMatch [21] := TRUE & (          (* line 874   *)
  2094.  NOT yyt^.alternative.case );
  2095.       yyMatch [25] := (25 IN match^[0]);
  2096.  
  2097.       cost := 1
  2098.       + CostCodeRules (yyt^.Alternative.expr)
  2099.       + CostCodeAltCase (yyt^.Alternative.alternative);
  2100.       IF cost < info^.CodeAltCase.Cost THEN
  2101.         info^.CodeAltCase.Cost := cost;
  2102.         info^.CodeAltCase.Proc := yyF23CodeAltCase;
  2103.       END;
  2104.       
  2105.       IF yyMatch [25] THEN
  2106.         cost := 1
  2107.         + CostCodeRules (yyt^.Alternative.expr);
  2108.         IF cost < info^.CodeAltIf.Cost THEN
  2109.           info^.CodeAltIf.Cost := cost;
  2110.           info^.CodeAltIf.Proc := yyF25CodeAltIf;
  2111.         END;
  2112.       END;
  2113.       
  2114.       cost := 1
  2115.       + CostCodeRules (yyt^.Alternative.expr)
  2116.       + CostCodeAltIf (yyt^.Alternative.alternative);
  2117.       IF cost < info^.CodeAltIf.Cost THEN
  2118.         info^.CodeAltIf.Cost := cost;
  2119.         info^.CodeAltIf.Proc := yyF26CodeAltIf;
  2120.       END;
  2121.       
  2122.       cost := 1
  2123.       + CostSetNumbers (yyt^.Alternative.expr)
  2124.       + CostSetNumbers (yyt^.Alternative.alternative);
  2125.       IF cost < info^.SetNumbers.Cost THEN
  2126.         info^.SetNumbers.Cost := cost;
  2127.         info^.SetNumbers.Proc := yyF35SetNumbers;
  2128.       END;
  2129.       
  2130.       REPEAT
  2131.         success := FALSE;
  2132.         IF yyMatch [20] THEN
  2133.           cost := 1
  2134.           + CostCodeAltCase (yyt);
  2135.           IF cost < info^.CodeRules.Cost THEN
  2136.             info^.CodeRules.Cost := cost;
  2137.             info^.CodeRules.Proc := yyF20CodeRules;
  2138.             success := TRUE;
  2139.           END;
  2140.         END;
  2141.         
  2142.         IF yyMatch [21] THEN
  2143.           cost := 1
  2144.           + CostCodeAltIf (yyt);
  2145.           IF cost < info^.CodeRules.Cost THEN
  2146.             info^.CodeRules.Cost := cost;
  2147.             info^.CodeRules.Proc := yyF21CodeRules;
  2148.             success := TRUE;
  2149.           END;
  2150.         END;
  2151.         
  2152.       UNTIL NOT success;
  2153.   | Tree.Sequence0:
  2154.       state := 12;
  2155.  
  2156.       cost := 1;
  2157.       IF cost < info^.CodeRules.Cost THEN
  2158.         info^.CodeRules.Cost := cost;
  2159.         info^.CodeRules.Proc := yyF18CodeRules;
  2160.       END;
  2161.       
  2162.       cost := 1;
  2163.       IF cost < info^.SetNumbers.Cost THEN
  2164.         info^.SetNumbers.Cost := cost;
  2165.         info^.SetNumbers.Proc := yyF32SetNumbers;
  2166.       END;
  2167.       
  2168.   | Tree.Sequence:
  2169.       state := 264;
  2170.       state := yyComb [state + yyTraverse (yyt^.Sequence.expr)];
  2171.       state := yyComb [state + yyTraverse (yyt^.Sequence.sequence)];
  2172.  
  2173.       cost := 1
  2174.       + CostCodeRules (yyt^.Sequence.expr)
  2175.       + CostCodeRules (yyt^.Sequence.sequence);
  2176.       IF cost < info^.CodeRules.Cost THEN
  2177.         info^.CodeRules.Cost := cost;
  2178.         info^.CodeRules.Proc := yyF19CodeRules;
  2179.       END;
  2180.       
  2181.       cost := 1
  2182.       + CostSetNumbers (yyt^.Sequence.expr)
  2183.       + CostSetNumbers (yyt^.Sequence.sequence);
  2184.       IF cost < info^.SetNumbers.Cost THEN
  2185.         info^.SetNumbers.Cost := cost;
  2186.         info^.SetNumbers.Proc := yyF33SetNumbers;
  2187.       END;
  2188.       
  2189.   END;
  2190.   RETURN state;
  2191. END yyTraverse;
  2192.  
  2193. PROCEDURE yyErrorCheck (i: INTEGER; s1, s2: ARRAY OF CHAR);
  2194. BEGIN
  2195.   IF i < 0 THEN
  2196.     IO.WriteS (IO.StdError, s1);
  2197.     IO.WriteS (IO.StdError, s2);
  2198.     IO.WriteNl (IO.StdError); IO.CloseIO; HALT;
  2199.   END;
  2200. END yyErrorCheck;
  2201.  
  2202. PROCEDURE BeginCodeM2;
  2203. VAR yyf: System.tFile; yyi: INTEGER;
  2204. BEGIN
  2205.   yyf := System.OpenInput (CodeM2TabName);
  2206.   yyErrorCheck (yyf, 'cannot open ', CodeM2TabName);
  2207.   yyi := System.Read (yyf, SYSTEM.ADR (yySets), SYSTEM.TSIZE (yySetsType));
  2208.   yyErrorCheck (yyi, 'cannot read ', CodeM2TabName);
  2209.   yyi := System.Read (yyf, SYSTEM.ADR (yyComb), SYSTEM.TSIZE (yyCombType));
  2210.   yyErrorCheck (yyi, 'cannot read ', CodeM2TabName);
  2211.   System.Close (yyf);
  2212.     (* line 237   *)
  2213.  
  2214.   vExport := FALSE;
  2215.   SpaCo := 0;
  2216.   InDefault := FALSE;
  2217.  
  2218. END BeginCodeM2;
  2219.  
  2220. PROCEDURE DoCodeM2 (yyt: Tree.tTree);
  2221. VAR yystate: yyStateType;
  2222. BEGIN
  2223.   yystate := yyTraverse (yyt);
  2224.   CODE (yyt);
  2225.   yyReleaseHeap;
  2226. END DoCodeM2;
  2227.  
  2228. PROCEDURE CloseCodeM2;
  2229. BEGIN
  2230.  
  2231. END CloseCodeM2;
  2232.  
  2233. BEGIN
  2234.   CodeM2TabName := 'CodeM2.tab';
  2235.   WITH yyInfo DO
  2236.     CODE.Cost := yyInfinite;
  2237.     CODE.Proc := yyECODE;
  2238.     CodeDef.Cost := yyInfinite;
  2239.     CodeDef.Proc := yyECodeDef;
  2240.     CodeImp.Cost := yyInfinite;
  2241.     CodeImp.Proc := yyECodeImp;
  2242.     CodeRules.Cost := yyInfinite;
  2243.     CodeRules.Proc := yyECodeRules;
  2244.     CodeAltCase.Cost := yyInfinite;
  2245.     CodeAltCase.Proc := yyECodeAltCase;
  2246.     CodeAltIf.Cost := yyInfinite;
  2247.     CodeAltIf.Proc := yyECodeAltIf;
  2248.     SetNumbers.Cost := yyInfinite;
  2249.     SetNumbers.Proc := yyESetNumbers;
  2250.     CodeExport.Cost := yyInfinite;
  2251.     CodeExport.Proc := yyECodeExport;
  2252.     CodeGlobal.Cost := yyInfinite;
  2253.     CodeGlobal.Proc := yyECodeGlobal;
  2254.     CodeLocal.Cost := yyInfinite;
  2255.     CodeLocal.Proc := yyECodeLocal;
  2256.     CodeBegin.Cost := yyInfinite;
  2257.     CodeBegin.Proc := yyECodeBegin;
  2258.     CodeClose.Cost := yyInfinite;
  2259.     CodeClose.Proc := yyECodeClose;
  2260.     CodeCodes.Cost := yyInfinite;
  2261.     CodeCodes.Proc := yyECodeCodes;
  2262.     CodeCodes2.Cost := yyInfinite;
  2263.     CodeCodes2.Proc := yyECodeCodes2;
  2264.   END;
  2265.   yyBlockList:= NIL;
  2266.   yyPoolFreePtr:= NIL;
  2267.   yyPoolEndPtr:= NIL;
  2268. END CodeM2.
  2269.